Skip to content
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

Animating CollisionShape extents makes KinematicBody2D invisible to Area2D #6286

Closed
RWmkII opened this issue Aug 25, 2016 · 6 comments
Closed

Comments

@RWmkII
Copy link

RWmkII commented Aug 25, 2016

Operating system or device - Godot version:
Windows 7 64bit
Godot v2.1 32bit

Issue description (what happened, and what was expected):
The setup:
The scene contains a small KinematicBody2D and a bigger Area2D. The KinematicBody2D can be moved with the arrow keys and prints "ENTER" and "EXIT" to the console when it enters or exits the Area2D, respectively. The KinematicBody2D also contains an AnimationPlayer, with a 3 seconds long animation consisting of nothing but a single key at the beginning of a track that animates the extents of the KinematicBody2D's collision shape, it doesn't actually change the extents, just sets them to the same numbers that they already had. This animation does not play automatically or loop, you can make it play once by pressing the Z key.

How it behaves:
If you move inside the area, it will print "ENTER" normally, then if you press Z while inside it will print "EXIT", then 3 seconds later print "ENTER". If you are outside and press Z before entering, it will only print "ENTER" after the 3 seconds are over. The KinematicBody2D is effectively invisible to the Area2D while the animation is playing.

Steps to reproduce:
See sample project.

Link to minimal example project (optional but very welcome):
AnimatingCollisionShape.zip

I apologize in advance if I messed up and this is not a bug.

@vnen
Copy link
Member

vnen commented Aug 26, 2016

You can't really animate CollisionShapes with AnimationPlayer, since those are only editor helpers and are disconnected from the actual body shapes at runtime. This will change in 3.0 but for now you have to workaround by animating via code (with the shape functions available to CollisionObjects).

@reduz
Copy link
Member

reduz commented Aug 26, 2016

I think animating them works now, kind of hacked but it should

On Aug 25, 2016 22:38, "George Marques" notifications@github.com wrote:

You can't really animate CollisionShapes with AnimationPlayer, since those
are only editor helpers and are disconnected from the actual body shapes.
This will change in 3.0 but for now you have to workaround by animating via
code (with the shape functions available to CollisionObjects
http://docs.godotengine.org/en/latest/classes/class_collisionobject2d.html
).


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#6286 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF-Z2xE_J9NKTFMYhy0wafKJjbsv6LIWks5qjkOKgaJpZM4JtnpR
.

@RWmkII
Copy link
Author

RWmkII commented Aug 26, 2016

Yes, when I searched for this issue before posting I saw that it used to be impossible to do, but was apparently added in September 2015. It's a very useful feature and I've been relying on it for my project. Worked fine while all I was colliding against was static bodies but when I threw area2d into the mix it started to misbehave.

@vnen
Copy link
Member

vnen commented Aug 26, 2016

Well, if they should work but are not, then it's a bug. Maybe the hacking wasn't so thorough.

@puppetmaster-
Copy link

@RWmkII Is your animationPlayer set to fixed_process?

@RWmkII
Copy link
Author

RWmkII commented Aug 26, 2016

Well good thing I apologized in advance, I forgot to set_animation_process_mode(0) and that fixed it. Thanks @puppetmaster and everyone, sorry for wasting your time. Not a bug after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants