I’m making a shootable enemy for my game, which I want to float in the air. I want it to be able to follow the player around and attack them.
(The cube is the enemy) I’ve animated the cube to rotate while it moves, too.
The entire map is baked, but whenever I start my game, the cube just falls to the ground and starts flipping (kinda like a dolphin lmao) and it won’t move anywhere.
(that is a sad, sad cube)
I’ve already gave the cube a collider that I set as a trigger to follow the player. How do I make the cube float above the water while it still is able to navigate and rotate? Please help! (this is my first game so im so lost!)
OK, the first thing you have to do it is have this hierarchy:
- Foe Controller (here you can put anything related to de NavMesh data).
- The creepy floating cube, Uuuuuuooh!, (sorry about that) .
The trick here it is to make the cube float using what ever you need to make it float, but this is the trick, the NavMesh it is only in the root, and the child it is the only that can float, it only has a collider attached and some component to control its behaviors (height variation, collision detection, etc.), when yo try to combine two or more behaviors the best way it is to have as many children inside the hierarchy (depending of the complexity obviously ), so, this way you can have more control about it, cheers.