Help with BodyGyros sliding

Which part of the bike is moving the entire bike?

Oh, its a part Called Balance, it acts like this:

1 Like

Maybe use the Idling bool value to also detect if Balance Part is moving. If it’s not it’ll change the P, D, and MaxTorque all to 0 and checks to see if the part itself is stagnant (utilizing the Magnitude property of the part).

It might look something like this.

-- previous code

if [BalancePart].Magnitude == 0 and Idling then

 [BalancePart].Anchor = true
end
else
-- previous code
 if not Idling then
  
    [BalancePart].Anchor = false
 end
end```
1 Like

Replace the [BalancePart] with the directory of the Balance part in explorer, or if there’s already a variable that gets the part Balance.

1 Like

I still don’t want to use anchor, just in case something happens like a block hitting the player but I’ll try that for a last resort if everything else fails

1 Like

You might not have to, you can just set all the values to 0 and not do the anchoring at all.

Try to do the code without anchoring it first.

There isn’t any extra BodyGyros for the wheels right; just for the part?

No there isn’t any extra Body Gyros, only that one

And you said you’ve already tried changing the MaxForce to 0,0,0 when it has been stopped, right?

yeah, If I change the Maxforce to 0,0,0 it stops the sliding but the bike will tip over then.

How about making the Velocity of Handles LookVector (Z) to 0?

It’s preset to 0 already, Ive seen that it doesn’t effect the orientation as any way I face will always lead to it sliding in the direction of it leaning

I would say, what if you used BodyVelocity instead of BodyGyros. You can make it increase in a fast pace, it’s more complicated to do though but it would get the job done if you coded it correctly.