Melee combat using hitboxes
by Juan Lemus · in Torque 3D Professional · 12/22/2009 (11:02 am) · 2 replies
Hi! Im using this resource for hitboxes:
http://www.torquepowered.com/community/resource/view/6538/
And I’m thinking of implementing it for melee combat. The idea is to have a sword model and that every time it hits an enemy it tells me what hitbox was hit. The problem is that I notice that the onCollision that is telling us what hitbox was hit is inside the projectile datablock and that if you want to create a new weapon you have to use Item and ShapeBaseImage datablocks. Is there a way to implement the onCollision of the projectile datablock in the ShapeBaseImage or Item datablock? Or is there a way of having a projectile datablock be a weapon that the character can pick up and be equipped to use it? I already have implemented this resource and have a sword shoot an invisible rocket. The problem is that we are looking for more accurate combat and the only way we can think of doing this is by making the sword be the projectile, have that projectile sword attach to the characters hand and have the character swing it around. Thanks for the help.
http://www.torquepowered.com/community/resource/view/6538/
And I’m thinking of implementing it for melee combat. The idea is to have a sword model and that every time it hits an enemy it tells me what hitbox was hit. The problem is that I notice that the onCollision that is telling us what hitbox was hit is inside the projectile datablock and that if you want to create a new weapon you have to use Item and ShapeBaseImage datablocks. Is there a way to implement the onCollision of the projectile datablock in the ShapeBaseImage or Item datablock? Or is there a way of having a projectile datablock be a weapon that the character can pick up and be equipped to use it? I already have implemented this resource and have a sword shoot an invisible rocket. The problem is that we are looking for more accurate combat and the only way we can think of doing this is by making the sword be the projectile, have that projectile sword attach to the characters hand and have the character swing it around. Thanks for the help.
About the author
I am the chief of the team in Lion Works studio, in Guatemala , Central America.
#2
What happens is that the player has to target a bodypart with their crosshair for the "swing" to land there. The weapon itself doesn't need to animate at all, as the player will handle the swinging bit. This doesn't look too bad with HL2's crowbar, but that's because it's a short weapon with a forward-thrusting "pop" style swing, and we can believe its strikes would be bullet-like. A large sword looks odd making a wide swing but hitting whatever your reticle is on.
That's probably not what you're looking for, but it's a workable solution if your game is not melee-centric (ie, if you're wanting to include a melee backup weapon in a shooter).
It's also possible (but more complicated) to attach a projectile to a node on an animated object. In this case, a node on the weapon image. By placing a projectile at the end of the sword (or several along the blade), you can be sure the collisions will be realistic. The projectiles delete after each swing, and are re-created at the start of each swing, to avoid the "multi-hit" scenario -- unless that's what you want. If you alter your projectiles to not self-terminate on impact, you can produce a sword that also causes passive damage when it's moved through things.
01/08/2010 (6:02 pm)
The cheapest method here is to create a weapon that fires invisible short-range projectiles, which is actually how the Source Engine handles its melee attacks I believe. While it won't accurately reflect the swing of the weapon, in practice players won't notice unless this is actually a swordfighting game.What happens is that the player has to target a bodypart with their crosshair for the "swing" to land there. The weapon itself doesn't need to animate at all, as the player will handle the swinging bit. This doesn't look too bad with HL2's crowbar, but that's because it's a short weapon with a forward-thrusting "pop" style swing, and we can believe its strikes would be bullet-like. A large sword looks odd making a wide swing but hitting whatever your reticle is on.
That's probably not what you're looking for, but it's a workable solution if your game is not melee-centric (ie, if you're wanting to include a melee backup weapon in a shooter).
It's also possible (but more complicated) to attach a projectile to a node on an animated object. In this case, a node on the weapon image. By placing a projectile at the end of the sword (or several along the blade), you can be sure the collisions will be realistic. The projectiles delete after each swing, and are re-created at the start of each swing, to avoid the "multi-hit" scenario -- unless that's what you want. If you alter your projectiles to not self-terminate on impact, you can produce a sword that also causes passive damage when it's moved through things.
Torque Owner Ken Johnston
Indiestructable Systems