How to reverse target a player hitbox?
by Jeff Yaskus · in Torque 3D Professional · 01/11/2014 (6:24 pm) · 2 replies
My goal was to make a RPG style damage, where first a random roll determines WHERE the player hits ... then have the players gun target that location and fire a projectile there for visual effects.
Meanwhile, the actual damage would be handled outside of the collision ... like a classic role playing game would do. (and the reverse of stock torque, where collisions do damage then a location is looked up)
How would I set the aim correctly to hit a given hit box location ?
such as the given hit locations below -Possible locations: head, torso, legs Head modifiers: left_back , middle_back, right_back left_middle, middle_middle, right_middle left_front, middle_front, right_front Legs/Torso modifiers: front_left, front_right back_left, back_right
somehow adjust it in here?
function AIPlayer::aimAt(%this,%object)
{
echo("Aim: "@ %object);
%this.setAimObject(%object);
%this.nextTask();
}... I can fire the "purely visual" projectile :) that's easy part.
Any psuedo code example would help
About the author
Long time gamer, hacker and programmer. With dreams of making video games -
#2
01/12/2014 (1:52 am)
getDamageLocation() seems to be working as designed. I tested a bunch of random positions around the actual target via script and found it IS reporting all of the middle locations, etc --just couldn't seem to make it happen by manually firing at the target.
Torque Owner Jeff Yaskus
jy games
function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageType) { if (!isObject(%obj) || %obj.getState() $= "Dead" || !%damage) return; // determine hit location %location = %obj.getDamageLocation(%position); %bodyPart = getWord(%location, 0); %region = getWord(%location, 1); echo("LOCATION:(" @ %position @ ") bodyPart = "@ %bodyPart @" || REGION = "@ %region );