Why is my seat moving downwards as it moves right?

Hello.

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

I have been relying on this video as I do not know how to use CFrame properly. https://www.youtube.com/watch?v=XDetRH5wjuQ&t=483s

2 Likes

Based on the blue highlight box, the seat itself seems to be slightly tilted down.

The reason is because this line

Basically you moving the seat based on the direction facing it, and since it’s tilted slightly downward, it moves forward that way.

2 Likes

Hello.

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
Setup

Then Weld the seat to the invis part

PrimaryPart

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

1 Like

Ello. I have tried that method just now. However, it doesn’t work and still does the same thing.

EDIT: I have made these two different Unions. The bottom part will move whilst the back part will move with the bottom part then rotate.
image

1 Like

The Seat is using ObjectSpace to move, and is therefore moving downwards (as that is right in the Seat’s ObjectSpace).

I’d just use position and wrap it in a CFrame.new, for example:

Move.C1 = CFrame.new(Move.C1.Position + Vector3.new(-0.09,0,0))

For some reason, that also changes the orientation of the object.

Ah yeah, I didn’t include the Orientation.
You can easily add it, like so:

local cframePosition = CFrame.new(Move.C1.Position + Vector3.new(-0.09,0,0))
local cframeOrientation = Move.C1.CFrame - Move.C1.CFrame.Position
Move.C1 = cframePosition * cframeOrientation

Or if you don’t fancy writing 3 lines:

Move.C1 = Move.C1 + Vector3.new(-0.09,0,0)

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.

2 Likes

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.

Local

image

Global

Is there any way to get the the part to move using Global and not Local?

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.

2 Likes

I have already tried to Union the Negative Part to the Union but looks like I’ve selected the Union first then the Part. It works now.
https://gyazo.com/ab7d66589efbe71d043876f0fee1b2f7

Thank you @BlastmanX20YT @BanTech and others who tried to help.

1 Like