How to make rotation limits?

This is my first post.

  1. I want to make it so that the car does not roll over, it has limits like Hinge.

  2. I have tried the body gyro but it made the car steer badly.

local BG = script.Parent.BodyGyro

BG.CFrame=CFrame.new(script.Parent.Position)
BG.MaxTorque=Vector3.new(500,0,500)
  1. The car is player character and i use platform stand so player can’t use original controls.

Cant you make it so when a certain Orientation is not met than it will automatically set to that?

For Example:

Part = workspace.Part -- LOL, A Part

Part.Orientation = Vector3.new(12,50,45) -- Example of Changed Orientation

Part.Changed:Connect(function() -- checks if a Property has changed
if Part.Orientation.Y ~= 75 then -- Check if its not equal to 75 (The Desired Orientation)

Part.Orientation = Vector3.new(Part.Orientation.X,75,Part.Orientation.Z) -- Sets Orientation Accordingly
     end
end)

In your case that might be 0,0,0 for orientation
For Animated Look, try CFrame:Lerp or TweenService

2 Likes

You should just make this vehicle heavier by increasing the Density and also lowering the Elasticity. But if it does manager to flip over, you can detect that and allow the user to flip the car with a button. If you really want limits for the rotation, you can use a LocalScript to clamp the Z rotation of the car’s CFrame between 2 values, every RenderStep.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.