0 votes

I'm trying to make the CollisionShape update it's shape and size with every frame of animation. I'm new to this so I don't really understand any intermediate language, but I read that with AnimationPlayer, I can set any parameter of a CollisionShape. How? Where do I go? Is it in the Inspector somewhere? Does it require code? What kind of code?

Godot version 3.2.2
in Engine by (19 points)

2 Answers

+1 vote
Best answer

Sorry for my english.

You can do that with the next steps:

1- Select your Animationplayer node.
1.5- (Create the animation if you don't have yet)
2- Select CollisionShape node.
3- In the inspector tab you can now see a little key next to all the propierties.
4- Select shape for see the collision dimension it self.
5- Now click in the key next to shape and the name of the propierty what show in the step 4.
6- Now in your animation in animationplayer node you can see a little diamond around the time line.
7- Move around the animation and change the propierties with the values that you want(don't forget click in the keys for save in the animation)
8- In your code only call the method play of animationplayer.
Something like this:

$AnimationPlayer.play("anim_name")
by (50 points)
selected by
+1 vote

You can do it from the editor, no need to write code. In the animation player add a new animation and then select the node with the properties you need to animate. You'll see a key icon aside the property, clicking it will allow you to create a track to animate that property.
The latest documentation (not stable) has a good tutorial, just be aware some features may not be available in version 3.2.x:
Animation tutorial

by (996 points)
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 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.