Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Applying a sideways velocity?

Hello. I'm scripting a hovercraft. I've got everything done, and it all works fine, but since I'm using a BodyThrust to move the vehicle, and a BodyPosition to keep it up (along with a BodyGyro and AngularVelocity, although those don't matter for this), it has no resistance, so it takes a very long time for velocity in certain directions to die down. So, when I turn, there's still velocity in my previous direction causing the vehicle to slide as if it's on ice.

EDIT: I now realize I need to apply a sideways force to the velocity, so my question now is: How do I get rid of the sliding, possibly by applying a sideways force to an object according to it's velocity?

Here's a game with my hovercraft for you to test:

(Ignore all the other assets & features) Hovercars

Thanks.

2 comments

0

The game example didn't update for a second, it's all fixed and testable now.

0

"The permission levels on this place prevent you from entering."

1 answer

✓ Accepted answer

Use BodyVelocity to move the hovercraft. This will provide two benefits over using BodyThrust.

  1. You can set a target velocity directly, instead of having to calculate the thrust to reach a target. This will come in handy when you want to set a cap on how fast the hovercraft can go.
  2. When you want the hovercraft to slow down (towards 0 velocity), you can set the target velocity to Vector3.new(0, 0, 0) instead of having to calculate a thrust to negate the velocity when sliding.

2 comments

0

Thank you, but I'm using a body thrust because it's relative and I'm using a body position to keep it upright. I'll experiment with body velocity.

1

Tried it out! It's working a bit better, still some sliding but that can be adjusted easily with the body velocity's properties. I thought Body Velocities would work totally weirdly with my hovercraft, I thought wrong!

This discussion is preserved as it was. New answers, comments, and votes are closed.