Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Making a character "hit box"

Author
Message
Brillig
16
Years of Service
User Offline
Joined: 19th May 2008
Location:
Posted: 14th Jul 2008 02:02
So, here's the deal.

I've got a main character in 3rd person running an "attack" animation where he swings a sword over his head and it lands in front of him.

I've got an enemy with a "death" animation.

I'm running sparky's collision.

How should I calculate whether the player has hit an enemy so that I can run the death animation at the correct times?

The only thing I've thought of is to put an invisible box in front of the player and when I'm near the final frame of the attack animation, see if an enemy is colliding with the box. If so, it dies.

I'm dissatisfied with this solution. Is there a better way that I'm just not thinking of?
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 14th Jul 2008 08:57 Edited at: 14th Jul 2008 08:58
You should try attaching a collision box to your weapon, i.e. glue it to the sword limb and scale it correctly, when you swipe the sword do checks for collisions between the collision box and anything else, if it hits an enemy then deal damage or play an animation, whatever. This is quite easy to do and fairly fast as Sparky's Collision Lib is quite optimized, the only possible issue is that if you get very low FPS, hit detection will be quite low. However there are things to get around this, such as ray-casting between the old and new positions of the blade tip, this way unless you're running so slow you don't even see the attack animation you should still hit things.

Brillig
16
Years of Service
User Offline
Joined: 19th May 2008
Location:
Posted: 14th Jul 2008 19:22
That seems like a better idea, and I like your advice about low fps
problems.

The problem is that my character is just one big animated mesh.

Do the limb functions work on the armature data I made in blender and then exported to directx?

What I mean is that I created a skeleton in blender and exported the mesh and animations to .x format. Is there a way to either access the "sword" arm as a limb or use dbLinkLimb to attach a sword limb to the right hand of my model?

Thanks for your help!
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 14th Jul 2008 21:11
If it's a single limb and the animation is vertex based, and not limb based then you won't be able to. I've not tried it but you might be able to use both vertex deformation animation with limb based on the same mesh, i.e. place the sword as a separate limb on your character and animate it so it's a separate limb, then you will be able to simply glue your collision box to the limb. But unless I'm mistaken there's no(native) way to get the bone structure/positions/rotations etc.

Quote: "Is there a way to either access the "sword" arm as a limb or use dbLinkLimb to attach a sword limb to the right hand of my model?"


I haven't used the animation features all that much in DBP/GDK but I'm pretty sure the skeleton used for vertex animation is inaccessible to the user and the object itself will in this case read as a single limb, so you won't be able to link any limbs as limbs aren't bones in the same sense.

Brillig
16
Years of Service
User Offline
Joined: 19th May 2008
Location:
Posted: 15th Jul 2008 00:15
Hmmm that's too bad. It was mostly wishful thinking on my part that I wouldn't have to go through the painstaking process of lining up my animations to my gdk limbs.

Login to post a reply

Server time is: 2024-09-30 01:23:37
Your offset time is: 2024-09-30 01:23:37