0 votes

Maybe it is a dumb question but anyways...

I habe a object (a) that fallows another object (b).
If object (a) collides with object (b), then no angle velocity shall be applied to (a).
Im using following code snipped of (a):

func _integrate_forces(state):
   var lv = state.get_linear_velocity()
   var vel = lv.length()
   var cc = get_closest_character()
   var t = state.get_transform()
   var step = state.get_step()

   (...)

   state.set_linear_velocity(lv)
   state.set_angular_velocity(0)

The last code line does not work.
Either state.set_angular_velocity(-state.get_angular_velocity()) gives a good result.

A help would be appreciated.

asked Jan 10 in Projects by heidebeere (16 points)

That seem counter-intuitive indeed, maybe it's a bug. I would not expect angular velocity to behave differently than linear velocity :|

It could be a bug or some collision force that is applied and not in the center.

Try putting it on character mode, should stop any rotation.

If bodies are like floating (no gravity), may need to be heavier too or have a bigger angular damp.

No bounce and high friction between bodies may help too.

1 Answer

0 votes

putting it on character mode

That helped! Thanks.
Maybe I should read the Documentation better.

answered Jan 10 by heidebeere (16 points)
edited Jan 10 by heidebeere

A angular velocity is still applied with ridig/kimatic body, while having custom integration on.
Its was like I miss a delta time where the angular velocity is processed/applied without my knowledge.

Thanks again.

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.