-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Unit tests for Node2D helper methods #91654
base: master
Are you sure you want to change the base?
Conversation
e1cce78
to
513dd56
Compare
513dd56
to
9bb4db4
Compare
10f9ded
to
42e1319
Compare
When you pass in a sibling into Node2D::get_relative_transform_to_parent, it must return Transform2D() according to the code, but it doesn't seem to do so. Does anyone know why?
|
That's not what happens with the code, it doesn't check for that, it just goes up the tree until it finds a non-2D node or no parent, it errors if the parent isn't a 2D node and then returns the empty transform, but it first combines this with the local transform: Lines 392 to 406 in c4279fe
|
The macro ERR_FAIL_NULL_V_MSG returns from the function if the pointer is null, and it doesnt combine with the local transform. Here's how i think it executes: because I'm passing in a sibling, we climb up the tree until we hit the root and then the root at the top of the tree will return null for get_parent(), and that causes the macro to err and return Transform(). I would like to debug this with breakpoints, but my breakpoints doesn't seem to hit on visual studio for tests, is there something I need to change to make that work?
|
No it calls for the steps until the parent is not a return parent_2d->get_relative_transform_to_parent(p_parent) * get_transform(); |
42e1319
to
9789156
Compare
@AThousandShips Ah yes, you're right, I somehow seemed to have forgotten about recursion going back down the stack. |
9789156
to
d1ee595
Compare
d1ee595
to
27b342e
Compare
Hello, can someone review this PR, it is ready to merge. |
Add Unit tests for Node2D helper methods (look_at, get_angle_to, to_local, to_global, get_relative_transform_to_parent)
Link to #43440