#Moving Model resets the Orientation (rotation)
76 messages · Page 1 of 1 (latest)
** You are now Level 2! **
send full script
Is there a better way i can send it to you?
I can send it in pieces if you want
ctrl-A
I did, that txt is the entire script
mb i was on phone it didnt show like that
soo ur problem is that after u place it 1 time with a a rotation, the next time u try to move the rotation becomes 0,0,0
right?
Exactly, originally it's at 0,0,0, then i move the model and rotate it by 90 degrees, then i place it. When i move it again the rotation resets to 0,0,0
But even if the original model rotation isn't 0,0,0 it gets resetted to 0,0,0
Original, After dragging it with mouse and rotating it, After being dragged again
I think the problem is on the local newPivot calculation, cause if i force it to be 0,math.rad(90),0, when i move it it stays like i wrote
No no i get the problem truna figure it out rn
** You are now Level 10! **
no i accidently deltet it
problem was when u were placed in the end
u werent saving it
and i made it as an attribute
But currentrotation shouldn't change value?
I mean in the old code it's currentRotation = OriginalCoordinates (movingObject:GetPivot()) Which is calculated every time you move it,
so if it's rotated, the pivot should change the values , or am i wrong?
Each time you moved and rotated an object, the rotation would reset to its initial state when the object was grabbed again
SavedRotation is getting the currentrotation value
But if i placed it rotated i saved the pivot, then when i take it again the pivot is recalculated and it should pass me the new values with the rotation, and assign them to currentRotation, this is what i did before
** You are now Level 3! **
Also, do i need to do movingObject:PivotTo() if i'm calling ApplianceMoveEvent that pivot too? i commented the first and it works anyway
It gave that laggy effect
I mean it does the same thing
ye sure
Ok i commented the PivotTo and left the ApplianceMoveEvent ones
Btw it works fine, thank you man i hope you the best
np
also everytime the runservice moved earlier it was multiplying it by 90
but u comented it
i was confused
what u were tryna do
you mean this? -local newPivot = CFrame.new(newPosition) * CFrame.Angles(0,math.rad(90),0)
ye
It was a test to see if it was the calculation to orient it at 0,0,0
with that line it was indeed always moving rotated by 90
I think so, but i was saving the rotation too before (i guess)
cause everytime i moved it i saved the OriginalCoordinates by getting the Pivot, then passing the values to currentRotation, so currentRotation was always updated
apparently i was wrong
Well no ur not entirely wrong i dont think
test if it works without that thing that keeps changing it
that was more like a test
This, i guess it updated currentRotation, cause GetPivot happens only everytime you take it to move it
I mean in debugging it was indeed updating
soo it works without chaning the attribute everytime?
Nope
I can send the debbuging values just like this
This is moving it (no rotations done)
Expanded
After the 90 degree rotation
As you can see currentRotation is getting updated by Original Coordinates (GetPivot())
not sure tbh
no wait, it's getting changed, The currentRotation assignation changed the values
I indeed lost the rotation like this
lmao
I was probably taking the wrong values from the Pivot
ye i just addet that part where it keeps getting changed just cuz
Cause with the rotation it passed from 0,0,0,1,0,0,0,1,0,0,0,1 to 0,1.5707,0,1,0,0,0,1,0,0,0,1
if i didnt we prolly be stuck rn
Bu the pivot is passing me weird values idk
Well i'm glad it works hahaha
lmao