Open illBeRoy opened 2 years ago
@illBeRoy Please upload a minimal reproduction project to make this easier to troubleshoot.
By the description, this is related with: https://github.com/godotengine/godot/issues/58269
Agree, seems like a duplicate of #58269, that issue mentions a workaround which does seem to work at the moment.
Godot version
4.0.alpha11
System information
M1 MBP, MacOS Monterey
Issue description
When nesting an AnimatableBody2D under a PathFollow2D, and changing the offset of the PathFollow node, the AnimatableBody node moves along the path, but the collision for that node stays at the origin.
For instance, take this scene:
And let's run it with paths and collision shapes visible:
As you can see, the animatable body and its child collision shape move along, but the collision detection still uses the origin point as where the platform really is.
Workaround
After updating the PathFollow2D offset, set the position of the AnimatableBody2D to itself:
Now the engine recognizes the new location of the collision shape, and updates accordingly:
Steps to reproduce
First, create a tree similar that contains a Path2D, PathFollow2D and a fully configured AnimatableBody2D:
Move the PathFollow2D node along the path using offset:
The collision of the AnimatableBody2D node did not update according to its new location.
Step to workaround
Right after you update the offset, assign the body's own global_position to iself. Now the collision is updated:
Minimal reproduction project
No response