0 votes

I have a 3D spaceship with a rigid body. I'm going for a control setup in which you press forward to accelerate and steer by moving the mouse. I have the following code set up:

 if Input.is_action_pressed("ui_up")
    $RigidBody. 

I'm not sure which rigid body function to use. I know I don't want apply impulse. What should I use? (I want the spaceship to have acceleration and decceleration, and I want to have control over those values.

Thanks, :)

in Engine by (297 points)
edited by

1 Answer

+1 vote

If you don't want to use physics build-in into RigidBody, and want to have more control over it, I would use KinematicBody instead.

You could then use functions like move_and_collide or move_and_slide to move the ship. This function also returns velocity vector, which you can store and use in next frame for stuff like smooth acceleration by running move_and_collide with velocity+acceleration.

by (125 points)

Thanks for the answer, You may be right, I'm having a ton of trouble with RigidBody code (it doesn't help that I'm a beginner.) I'll try it.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories