• 3D
  • Play animation on entering area?

Ok, I don't know what I'm doing wrong or if there are some limitations I'm not aware of.

I have made an animation in Blender of 4 rocks falling. 3 of them have a collisionshape so the car can't drive through them. Since they only need fall once and then are part of the track, I have them as StaticBody. With the import, there was one AnimationPlayer created, with the 4 animations of the falling rocks in it. They do work in the editor. But what am I doing wrong here? Because when I go to that area, only on rock has already fallen even before I enter that area and is even floating. When I comment 3 of the animations, the rock falls completely, but again has already fallen before I get there.

So what's wrong with my code? And isn't there a way to just say that that player needs to play all the animations in it? Why do I need to call every rocks animation seperatly?

Maybe something else triggering the area signal prematurely?

Don't know what that could be, there is nothing there. Only assets off the level and the invisible wall/ground for the collision. The only Body is the car.

The animation doesn't play automatically on load, right? You always have to say when it needs to start to play? I was thinking I maybe was missing a setting.

Edit: Ok, I just add a print("Entering DangerZone") to that part and it indeed triggers on load, because the car isn't even in the vicinity of that area. (It's a cylindershape).

So apparently it were the collisionshapes of the track that are triggering the Entering Area. So how do I prevent that? Only cars should be able to trigger it. Because now my area is too small so that I don't hit something that I don't want. But it isn't a flat track either and I need to the area to cover a certain distance.

**Also, I still have the problem with the 4 animations that the first falling rock stops falling halfway, probably when the 2nd one wants to start to animate. Why is that?

Edit: for the area entered problem, am I looking in the right direction if I go change some things with the collision layers/mask?**

You can check the body group in the collision check, see if it is a car (you'll have to set the group on all the cars for this to work). You can also check the name, and see if it starts with car (assuming your car nodes all start with "car").

For the animation, you are playing 4 at the same time on the same object, I believe they are over-writing each other. You may want to make each rock a separate object with it's own animation if you need them to animate at different times.

Body groups, that is that tab under the Node tab? Currently it is working now, with setting things on different collision layers (just remembered that from the GDQuest 2D tutorial). So now I have 4 physics layers: "Cars", "Track", "Environmental Hazards" and "Triggers" and all of them only have the "Cars" layer as a mask. Don't know if this is the right/optimal way of doing it? It seems to work though.

I imported the track, assets and animation using Blender, exporting it as a glTF, with the NLA animations. The 4 rocks that fall, are also different nodes/objects, as you can see in the image. Or is that not what you meant? Problem is, that they need to play at exactly the same time. Atleast that is how I animated them in Blender. So for example, if rock 1 starts falling at frame 1, rock 2 starts falling at frame 8, rock 3 at frame 11, ... .

You would have to combine all those animations into one.

Yeah, I'm trying to get all those actions onto separate tracks in that same animation player, but I don't know how. Google and Youtube still didn't yield any useful or working solutions. In the Docs, I'm also finding something about Animation mode at the bottom of this page: https://docs.godotengine.org/en/latest/getting_started/workflow/assets/escn_exporter/animation.html.

So this is about the Blender export, Godot import workflow, but I can't seem to find this in Godot. Where is this located at? In the Docs it refers the Animation mode as an "add-on". So this is something that needs to be installed separately? Everything I find either just goes about straight exporting and nothing more of creating animations in the Animation Editor, but nothing that helps me with my problem.

So my current solution is this, but I find it kinda messy. They should implement a way so that you can add the Animation Actions to a track in an AnimationPlayer