Position2D not rotating with parent.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By OiKeTTLe

I’ve moving a KinematicBody2D using the look_at() function, getting the target node’s global_position. The Position2D attached to my KinematicBody2D won’t rotate. It also won’t change position; I’ve tried printing both global_position and global_rotation, and they stay the same despite moving and rotating. I’m not sure what the issue could be, as this exact same setup works in similar scenes. Not sure what the issue could be, anyone have an idea? Thanks.

Check if the Position2D is a top level node (not inheriting the transform of parent nodes) by printing (position2D_node).is_set_as_toplevel(). If that prints true use (position2d_node).set_as_toplevel(false) to fix it. If that’s not the case we’ll probably need to see your node hierarchy and some code in order to help you diagnose your problem.

timothybrentwood | 2021-11-01 13:53

It prints as false.

OiKeTTLe | 2021-11-01 22:21

Solved it, I was calling the look_at() function after the shoot() function, setting the bullet’s transform before actually moving.

OiKeTTLe | 2021-11-01 22:23