#character rotating 180 degrees when hugging a wall

2 messages · Page 1 of 1 (latest)

quiet solar
#

im using this code for rotating my character depending on the direction:

node.rotation.y = lerp_angle(node.rotation.y,atan2(-velocity.x,-velocity.z),0.1) ```
the code works but when i hug the wall it rotates 180 degrees (i want the character to still look at the wall). how can i do that?