Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | a human |
Does anyone know how I would make a RigidBody2D rotate towards another? I’ve tried:
if groundsense.is_colliding(): var ground = groundsense.get_collider() var groundp = ground.get_global_position() var grangle = groundp.angle on_ground = true if grangle > 3.14: applied_torque -= torque elif grangle < 3.14: applied_torque += torque elif grangle == 3.14:
, where groundsense is a raycast aimed under the players feet. The issue is, I keep getting seemingly random values based on what I am colliding with. Is it the raycast that’s messing things up? If so, how do I fix this? If I messed up in other places, please help me.
Have you looked into the look_at()
function?
Ertain | 2020-01-30 03:43