Help With Bobsled Physics

Alright, I’ve been working on physics for a bobsled system for a few days now.

The system currently will just go in the direction of the track no matter the orientation of the sled.
As you can see here, the bobsled is going backwards down the track:

So here’s my rough solution:
Find the direction the sled is moving and use some form of rotational force to slowly turn the bobsled to where its heading.

My issue is I don’t know how to find the direction an object is moving in, and what I should use to rotate the sled using something similar to a body force.

Help would be appreciated :grinning_face_with_smiling_eyes:

You will be able to tell what direction the bobsleigh is going by taking its AssemblyLinearVelocity which is a vector that points in the direction it is moving as well as its magnitude is the speed the object is travelling at. You can use a BodyGyro where the MaxForce is limited to whatever you choose and then make the object face the direction it’s travelling by using CFrame.lookAt:

local Bobsleigh = -- reference to the bobsleigh object
local Origin = Bobsleigh.Position
local Velocity = Bobsleigh.AssemblyLinearVelocity.Unit
BodyGyro.CFrame = CFrame.new(Origin, Origin + Velocity)
1 Like

Is there a way I could make it only change on the Y axis? When turning the sled stays upright.
image

Change the MaxForce of the BodyGyro to make the max force on the X and Z axes 0. Also, there’s something else to address. If you’re using a loop or any related constructs, then I’d advise you have a variable that stores the last CFrame of the BodyGyro and not make the code above run if the bobsled is not moving, because this can present some issues:

local Velocity = Bobsleigh.AssemblyLinearVelocity
if Velocity.Magnitude > 0 then
    local Bobsleigh = -- reference to the bobsleigh object
    local Origin = Bobsleigh.Position
    local Velocity = Bobsleigh.AssemblyLinearVelocity.Unit
    BodyGyro.CFrame = CFrame.new(Origin, Origin + Velocity)
    lastCF = BodyGyro.CFrame
elseif lastCF then
    BodyGyro.CFrame = lastCF
end
1 Like

Thanks for the help! I’ll use this a lot!