0 votes

I've moving a KinematicBody2D using the lookat() function, getting the target node's globalposition. The Position2D attached to my KinematicBody2D won't rotate. It also won't change position; I've tried printing both globalposition and globalrotation, 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.

Godot version 3.2.3
in Engine by (103 points)
edited by

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.

It prints as false.

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

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.