getting physx objects to apply damage?
by deepscratch · in Torque Game Engine Advanced · 03/20/2009 (4:06 am) · 2 replies
hi there,
how would one go about getting a physx object to apply damage to a player/vehicle/aiplayer/whatever?
this is the scenario:
the wall of physx boxes; when my grenades go off near the wall, the boxes fly off in good old physx style, but when they hit other objects, they dont damage them.
how to get those flying physx boxes/whatevers, to apply impact damage to player/vehicle/aiplayer/whatever?
thanks.
how would one go about getting a physx object to apply damage to a player/vehicle/aiplayer/whatever?
this is the scenario:
the wall of physx boxes; when my grenades go off near the wall, the boxes fly off in good old physx style, but when they hit other objects, they dont damage them.
how to get those flying physx boxes/whatevers, to apply impact damage to player/vehicle/aiplayer/whatever?
thanks.
About the author
email me at medan121@gmail.com
Recent Threads
#2
03/20/2009 (11:29 am)
@deepscratch, you'll have to check out the PhysX contact notification system. You'll want to set it up and call back to the PhysX actor's Torque object so you can do as Steve mentions.
Associate Steve Acaster
[YorkshireRifles.com]
[psuedocode]
function YourObject::onCollision(%this,%obj,%col)
{
if (%obj.getState() $= "Dead")
return;
if (%col.getClassName() $= "damageable" || %col.getClassName() $= "Player")
{
%col.damage=%obj.getvelocity;
}
}
[/psuedocode]
Something like that ... only better.