Create a bounding box during animations?

Problems building or running the engine, queries about how to use features etc.
Post Reply
CrispyArrow
Gnoblar
Posts: 5
Joined: Sun Apr 10, 2016 1:27 pm

Create a bounding box during animations?

Post by CrispyArrow »

I have an entity that uses the ninja.mesh, when I press the left mouse button it plays an attack animation. At the end of the animation i check whether any enemy entity (in this case, the robot.mesh) is close enough to the ninja entity. if so, i substract health off the robotmesh that is close. the problem with this is as follows: the animation is a sword swing, but because of the way the code is implemented, the enemy will be damaged even when it's behind the player if close enough.

What i'd prefer is to make use of a bounding box. basically, when the animation is running, on a specific frame i want to create a bounding box in front of the player and then delete it once the animation i finished.

So I have 2 questions:
- Can i create a bounding box without the excessive need of creating an entire entity?
- Is this a good way to handle combat collisions? at the moment I cannot think of a different solution (because I am a noob at programming, and a bigger noob at ogre3d), but if there's a more simplistic or better even: a more realistic way of handling combat collisions, I'd love to know how to implement this.

If I am being vague or unclear about something, please let me know.

Thank you in advance!
Post Reply