Not exactly sure if this is the wrong catagory but let me know if it is so that I will be able to move it.
Anyways. I have a seat here. I want the seat to move forwards (Right on the GIF). The seat is able to move fowards, but also moves downwards, which I do not want. If you are curious to find out what it is meant to do, the seat is meant to recline.
I have attempted to add a part and union it, just to straighten the union. However, that was not successful as it is still stuck to a different orientation. https://gyazo.com/98eba1edd04148f9552b67897c687f58
This is my code:
local Seat = script.Parent
local Move = Seat.Move:WaitForChild("Motor")
for i = 1,20 do
Move.C1 = Move.C1 * CFrame.new(-0.09,0,0)
wait(.005)
end
Might be stupid of me to ask this but how do I stop the seat from moving downwards? Is there something I need to add to my code or do something to the actual model?
The best way i found to fix this is to make a model with the seat and a invis part
Then Weld the seat to the invis part
Then Set the PrimaryPart to the Invis Part and move the seat the the invis Part and not the seat
so put the script and motor in the model and not the seat
You can add vectors to a CFrame. It translates the CFrame by the vector, keeping its rotation. A lot simpler than splitting them up to combine them back together again later.
Changing the “CFrame” bit to “Vector3” has not made a difference as it still continues to move downwards. However, I think the main issue with my part is that it is moving in Local directions. I want it to move in Global Directions.
As people have suggested, have an invisible, correctly oriented part, welded to the rest of the chair, and move that invisible part instead of the chair union.
Alternatively, union it again with a correctly oriented negated part that isn’t intersecting any of the other geometry. Make sure to select the negated part first and then the chair union when doing this, otherwise it’ll keep the same orientation as before.
Welds are always local to the two parts being welded, and you want local, not global, or your chair will move in even weirder ways when your vehicle is pointing a different direction. Your weld should be between two like-oriented parts if you want the simplest behaviour of just translating in one direction.