|
| 29 Jan 2017 07:24 AM |
function Fix(Part) pos=Vector3.new( (math.floor(Part.Position.X*RoundBy + 0.5))/RoundBy, (math.floor(Part.Position.Y*RoundBy + 0.5))/RoundBy, (math.floor(Part.Position.Z*RoundBy + 0.5))/RoundBy ) rot=Vector3.new( (math.floor(Part.Rotation.X*RoundDegree + 0.5))/RoundDegree, (math.floor(Part.Rotation.Y*RoundDegree + 0.5))/RoundDegree, (math.floor(Part.Rotation.Z*RoundDegree + 0.5))/RoundDegree ) Part.CFrame=CFrame.new(pos) * rot end
Workspace.script:11: bad argument #3 to 'CFrame' (CFrame expected, got Vector3)
what?
|
|
|
| Report Abuse |
|
|
|
| 29 Jan 2017 07:25 AM |
forgot these
local RoundBy=10 local RoundDegree=15 |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 29 Jan 2017 07:25 AM |
| You can't multiply a CFrame with a vector3, you can multiply it with a CFrame. |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 29 Jan 2017 07:26 AM |
nvm you can totally multiply it with a v3 im stupid what is line 11 |
|
|
| Report Abuse |
|
|
|
| 29 Jan 2017 07:28 AM |
line 11 = Part.CFrame=CFrame.new(pos) * rot
|
|
|
| Report Abuse |
|
|
|
| 29 Jan 2017 07:31 AM |
I tried Part.CFrame=CFrame.new(pos) * CFrame.Angles(rot) but that got me bad argument #3 to 'Angles' (number expected, got no value) 14:30:44.846 - Stack Begin |
|
|
| Report Abuse |
|
|
|
| 29 Jan 2017 07:33 AM |
for rot
instead of Vector3.new
put
CFrame.Angles
might want to convert to radians first though
|
|
|
| Report Abuse |
|
|
|
| 29 Jan 2017 07:37 AM |
^^ read my previous message |
|
|
| Report Abuse |
|
|
|
| 29 Jan 2017 07:39 AM |
nonono
this line
rot=CFrame.Angles( (math.floor(Part.Rotation.X*RoundDegree + 0.5))/RoundDegree, (math.floor(Part.Rotation.Y*RoundDegree + 0.5))/RoundDegree, (math.floor(Part.Rotation.Z*RoundDegree + 0.5))/RoundDegree )
|
|
|
| Report Abuse |
|
|
|
| 29 Jan 2017 07:40 AM |
local RoundBy=10 local RoundDegree=15--round to nearest x degrees local r = math.rad
function Fix(Part) pos=Vector3.new( (math.floor(Part.Position.X*RoundBy + 0.5))/RoundBy, (math.floor(Part.Position.Y*RoundBy + 0.5))/RoundBy, (math.floor(Part.Position.Z*RoundBy + 0.5))/RoundBy ) rot=Vector3.new( (math.floor(Part.Rotation.X*RoundDegree + 0.5))/RoundDegree, (math.floor(Part.Rotation.Y*RoundDegree + 0.5))/RoundDegree, (math.floor(Part.Rotation.Z*RoundDegree + 0.5))/RoundDegree ) Part.CFrame=CFrame.new(pos) * CFrame.Angles(r(rot.X),r(rot.Y),r(rot.Z)) end
This works technically, but the position of the parts are all weird and warped. |
|
|
| Report Abuse |
|
|
|
| 29 Jan 2017 07:42 AM |
function Fix(Part) local r = math.rad pos=Vector3.new( (math.floor(Part.Position.X*RoundBy + 0.5))/RoundBy, (math.floor(Part.Position.Y*RoundBy + 0.5))/RoundBy, (math.floor(Part.Position.Z*RoundBy + 0.5))/RoundBy ) rot=CFrame.Angles( (r(math.floor(Part.Rotation.X*RoundDegree + 0.5))/RoundDegree), (r(math.floor(Part.Rotation.Y*RoundDegree + 0.5))/RoundDegree), (r(math.floor(Part.Rotation.Z*RoundDegree + 0.5))/RoundDegree) ) Part.CFrame=CFrame.new(pos) * rot end
copy that exactly?
|
|
|
| Report Abuse |
|
|
|
| 29 Jan 2017 07:44 AM |
| It's not the rotation. The position is weird though. I am applying CFrame to all kinds of parts, both anchored and unanchored, and welded? Maybe the welds is doing something weird. |
|
|
| Report Abuse |
|
|
|
| 29 Jan 2017 07:45 AM |
| For clarification, RoundBy, rounds to the nearest RoundBy^-1 position on the axis |
|
|
| Report Abuse |
|
|
|
| 29 Jan 2017 07:49 AM |
I fixed it. It's a script that corrects the brickshift glitch btw, I'm sure you know what it is (or google it)
Script:
local RoundBy=10--rounds to the nearest RoundBy^-1 position on the axis local RoundDegree=15--round to nearest x degrees local r = math.rad
function Fix(Part) pos=Vector3.new( (math.floor(Part.Position.X*RoundBy + 0.5))/RoundBy, (math.floor(Part.Position.Y*RoundBy + 0.5))/RoundBy, (math.floor(Part.Position.Z*RoundBy + 0.5))/RoundBy ) rot=Vector3.new( (math.floor(Part.Rotation.X*RoundDegree + 0.5))/RoundDegree, (math.floor(Part.Rotation.Y*RoundDegree + 0.5))/RoundDegree, (math.floor(Part.Rotation.Z*RoundDegree + 0.5))/RoundDegree ) Part:BreakJoints() Part.CFrame=CFrame.new(pos) * CFrame.Angles(r(rot.X),r(rot.Y),r(rot.Z)) Part:MakeJoints() end
function Find(Part) Inside = Part:GetChildren() if Part.ClassName=="Seat" or Part.ClassName=="Union" or Part.ClassName=="VehicleSeat" or Part.ClassName=="Part" or Part.ClassName=="MeshPart" then Fix(Part) for _, InsidePart in pairs (Inside) do Find(InsidePart) end end end
function Correct(Subject) for _, Obj in pairs(Subject:GetChildren()) do Find(Obj) end end
Correct(workspace["Model name here"]) |
|
|
| Report Abuse |
|
|