0 votes

how to point a rigidbody2d to point at it's velocity , the node has it's velocity given by its parent through aapplied_impulse
this is the whole line of code

selected_spell_instance.apply_impulse(Vector2(), Vector2(spell_speed, 0).rotated(rotation 
+ rand_range(-trembeling,trembeling)))

the selectedspellinstance is the node i added as a child , and the trembeling is a little quirk for the node to shoot in a little different direction everytime

and then i apply the rotation to the node

selected_spell_instance.rotation = rotation
asked May 10 in Projects by i.want.to.die (28 points)

1 Answer

+1 vote

To avoid jittery rotation, you could store lerp() the node's rotation by a certain amount every frame so it doesn't occur instantly. You could also use the Tween node to do that.

Also, you may want to rotate only the node's visual representation, rather than the whole RigidBody. This is especially true if your RigidBody's collision is a circle or sphere, as there would be no point in rotating it on your own.

answered May 11 by Calinou (5,674 points)

thank you very much!

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.