Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | mateusak | |
Old Version | Published before Godot 3 was released. |
The docs states
Return whether the body would collide, if it tried to move in the given vector. This method allows two extra parameters: A margin, which increases slightly the size of the shapes involved in the collision detection, and an object of type Physics2DTestMotionResult, which will store additional information about the collision (should there be one).
But how can I get the Physics2DTestMotionResult? I tried doing it like this:
var p
if (test_motion(vector, 0.08, p)):
var k = p.get_motion_remainder()
But I get the following error:
Invalid call. Nonexistent function 'get_motion_remainder' in base 'Nil'.
What’s the right way to do it?
I’m interested too on the answer to this question.
genete | 2016-05-04 09:11