Deactivate angle velocity

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By heidebeere
:warning: Old Version Published before Godot 3 was released.

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.

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

Zylann | 2017-01-10 14:04

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.

eons | 2017-01-10 14:16

:bust_in_silhouette: Reply From: heidebeere

putting it on character mode

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

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.

heidebeere | 2017-01-10 15:38