Help to fix car system

Hello,
I have a problem with a bumper car that doesn’t align with the ground when spawned on a not flat ground. (The car does not change angle)

I already tried to modify the script but does not fix anything.

this is the problem :
Capture d'écran 2024-10-27 195438

Capture d'écran 2024-10-27 195455

Thank you for you answers !

Can you explain more on how this system works? Is it physics based or using CFrame.

The mouvement sytem is based on mooving with angular an linear velocity ( so yeah CFrame)

Okay, are you able to provide a snippet so I can better understand?

local bodyGyro = Instance.new("BodyGyro")
bodyGyro.MaxTorque = Vector3.new(1e5, 1e5, 1e5)
bodyGyro.CFrame = primaryPart.CFrame
bodyGyro.P = 3000
bodyGyro.Parent = primaryPart

local function updateMovement()
	local throttle = seat.Throttle
	local steer = seat.Steer


	local forwardDirection = seat.CFrame.LookVector * throttle * 50
	local strafeDirection = seat.CFrame.RightVector * steer * 50
	local movementVector = forwardDirection + strafeDirection

	if throttle ~= 0 or steer ~= 0 then
		bodyVelocity.Velocity = Vector3.new(movementVector.X, 0, movementVector.Z)

		local steerMultiplier = 10
		local steerAngle = steer * math.rad(-5 * steerMultiplier)
		local targetCFrame = primaryPart.CFrame * CFrame.Angles(0, steerAngle, 0)

		bodyGyro.CFrame = targetCFrame
	else
		bodyVelocity.Velocity = Vector3.new(0, 0, 0)
	end
end

Does the bumper car start at that unstable position or does it happen after moving?


Sorry for the stream background sound

Oh I see, so it’s not correcting it’s rotation, one way of fixing this could be raycast at the bottom then counteracting the current rotation to stay level, unsure how well it would work for this situation though.

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