Q: Help understanding getDamageLocation()
by Jarrod Roberson · in Torque Game Engine · 05/15/2002 (7:36 am) · 5 replies
Can someone please explain the parameters in the following method in Player.
void getDamageLocation(const Point3F& in_rPos, const char *&out_rpVert, const char *&out_rpQuad);
in_rPos is a Point3F that much is obvious!
Is in_rPos on the hitbox or the model?
You pass in a Point3F and what does it set back?
Q: What does the in_rPos represent, where is that point?
Q: What does out_rpVert represent?
Q: What does out_rpQuad represent?
void getDamageLocation(const Point3F& in_rPos, const char *&out_rpVert, const char *&out_rpQuad);
in_rPos is a Point3F that much is obvious!
Is in_rPos on the hitbox or the model?
You pass in a Point3F and what does it set back?
Q: What does the in_rPos represent, where is that point?
Q: What does out_rpVert represent?
Q: What does out_rpQuad represent?
About the author
#2
I think I will have to expand on this function just a tiny bit :)
05/15/2002 (4:25 pm)
ok that was not obvious but I see it now.I think I will have to expand on this function just a tiny bit :)
#3
Hitboxes = multiple boxes used to track collision. Move with model and animations, very accurate. Usually linked around each limb or major body part (i.e: lower leg, upper leg, head)
Collision box = simple, usually axis aligned or rotated from main axis. Is used for the core collisions with terrian and archetecture. Very inaccurate when area-based damage is required using this type of "hit box"
The function is pretty basic.
It assumes you don't need "real" hit boxes, so it creates them based on a simple calculation based on the size and area the collision hits the collision box.
Head = top part of the box
Chest = middle part
Legs = bottom
The "locations" are determined by a percent value taken from the "Player" datablock in scripts. This means you'll have to manually tailor each model to it's "correct" values or else you might have a normal human's proportions cause a head shot on a big-headed alien to count as a chestshot, doing minimal damage!
Simple, huh? Too simple really...
Then, it determines which "side" of the model you hit by just doing some simple maths on the collision box and the collision point.
And the same goes for the left, right, and middle. All related to area on collision box that was hit. Would be useful to figure out animations to play (i.e, get "right" and you'll die slouching to the left)
If you can't tell, this is a very simple way of doing it albiet very easy on the cpu and memory.
If you plan on using a game that hit boxes aren't required (like a more realistic RTS) then this is good enough to suit your project.
If you are doing a game that requires some more realistic calculations on the model itself, you're going to need to integrate actual hit boxes. Raistlin did a good tutorial that added hitboxes for melee weapon collision. It wouldn't be too hard to adapt it to projectiles.
Good luck!
05/15/2002 (4:29 pm)
Let's clear things up first.Hitboxes = multiple boxes used to track collision. Move with model and animations, very accurate. Usually linked around each limb or major body part (i.e: lower leg, upper leg, head)
Collision box = simple, usually axis aligned or rotated from main axis. Is used for the core collisions with terrian and archetecture. Very inaccurate when area-based damage is required using this type of "hit box"
The function is pretty basic.
It assumes you don't need "real" hit boxes, so it creates them based on a simple calculation based on the size and area the collision hits the collision box.
Head = top part of the box
Chest = middle part
Legs = bottom
The "locations" are determined by a percent value taken from the "Player" datablock in scripts. This means you'll have to manually tailor each model to it's "correct" values or else you might have a normal human's proportions cause a head shot on a big-headed alien to count as a chestshot, doing minimal damage!
Simple, huh? Too simple really...
Then, it determines which "side" of the model you hit by just doing some simple maths on the collision box and the collision point.
And the same goes for the left, right, and middle. All related to area on collision box that was hit. Would be useful to figure out animations to play (i.e, get "right" and you'll die slouching to the left)
If you can't tell, this is a very simple way of doing it albiet very easy on the cpu and memory.
If you plan on using a game that hit boxes aren't required (like a more realistic RTS) then this is good enough to suit your project.
If you are doing a game that requires some more realistic calculations on the model itself, you're going to need to integrate actual hit boxes. Raistlin did a good tutorial that added hitboxes for melee weapon collision. It wouldn't be too hard to adapt it to projectiles.
Good luck!
#4
Please stop putting Q: in front of your forum titles. What the heck else would you be using as a title? :)
Hitboxes do not exist in torque. I did release a tutorial quite a while ago showing how to get some basic collision stuff in, but right now I am working on one that is infinitely better: better explained, better coded, more versatile, more complete, etc. It should be done by the end of this weekend or so.
05/16/2002 (1:16 pm)
A few things here to mention:Please stop putting Q: in front of your forum titles. What the heck else would you be using as a title? :)
Hitboxes do not exist in torque. I did release a tutorial quite a while ago showing how to get some basic collision stuff in, but right now I am working on one that is infinitely better: better explained, better coded, more versatile, more complete, etc. It should be done by the end of this weekend or so.
#5
05/16/2002 (2:26 pm)
the Q: makes it obvious it is a Question and not just blathering, but most importantly it makes it where I can search for them easier!
Torque Owner Badguy
this strings are used to store location :
legs
torso
head
the other stores front back side side info..
the point passed in is for checking against the box.