Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | heidebeere | |
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
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