How can I keep this from happening?

For a while… I was working on a chassis similar to jailbreak’s chassis (And I am still working on it to this day), So today… I started working on a wheel system for the chassis. But… when my suspension height is more than 0… this happens:

Can someone please tell me how I can keep this from happening?

Here is the code:

-- leftVector
local suspensionHeight = 1

game:GetService("RunService").Heartbeat:Connect(function(dt)
	local velocity = math.floor(script.Parent.Thruster.Velocity:Dot(script.Parent.Thruster.CFrame.RightVector) * dt + 0.5)
	script.Parent.Thruster.WheelWeld.C0 = script.Parent.Thruster.WheelWeld.C0 * CFrame.new(0, suspensionHeight, 0) * CFrame.Angles(-math.rad(1), 0, 0)
end)

Here is the model:

https://www.roblox.com/library/4588690337/Wheel-Example

That’s because CanCollide is off, well, as i can see in your video. I hope this helps :+1:
@DragRacer31

Then why would this not be happening… if the suspension height is 0 :thinking: ?

What do you mean with that?

30chars

Look at the code… and set the variable called “suspensionHeight” to 0… then see what happens.

Yeah, i set to 0, and i can see that your block is not doing a collision, and something like floating in the ground, that’s what im telling you, to remove that issue you must set the CanCollide of the Wheel to true. Going to mention that you are not saying what is your issue here.

The video explains it pretty well. Including what I have said above / before the video…

I am not aware of how Jailbreaks chassis system works, but I assume you are attempting to rotate the wheel suspensionHeight studs above the Thruster? In which case does this solve your problem?

local suspensionHeight = 2

local weld = script.Parent.Thruster.WheelWeld
game:GetService("RunService").Heartbeat:Connect(function(dt)
	local velocity = math.floor(script.Parent.Thruster.Velocity:Dot(script.Parent.Thruster.CFrame.RightVector) * dt + 0.5)
	weld.C0 = weld.C0 * CFrame.Angles(math.rad(60)*dt, 0, 0) + Vector3.new(0, suspensionHeight-weld.C0.Y, 0)
end)
1 Like

You’re offsetting it by suspensionHeight on the Y axis every frame, you should store the original C0 in a variable, Also in your case, rotation should be applied before offsetting like this

local suspensionHeight = 3

local OriginalC0 = script.Parent.Thruster.WheelWeld.C0
game:GetService("RunService").Heartbeat:Connect(function(dt)
	local velocity = math.floor(script.Parent.Thruster.Velocity:Dot(script.Parent.Thruster.CFrame.RightVector) * dt + 0.5)
	script.Parent.Thruster.WheelWeld.C0 = OriginalC0 * CFrame.Angles(tick() % math.pi, 0, 0) * CFrame.new(0, suspensionHeight, 0)
end)

tick() returns how much time has elapsed since the UNIX epoch in seconds
% math.pi divides the number by math.pi and gets the remainder

1 Like

Even though you might not know how jailbreaks chassis works… Yet… You at least have solved my problem.

2 Likes