Inconsistent Collisions?
by Jeremy Alessi · in Torque Game Engine · 02/21/2005 (4:19 pm) · 4 replies
I've changed a few things in my player.cs, crossbow.cs, and radiusdamage.cs files which have caused my explosions to only sometimes damage and push a player away. Often times the explosions do nothing ... what could cause this? The problem doesn't seem to be in radiusdamage.cs because when an explosion collision is registered it functions correctly. However, I can't seem to pinpoint by looking at the scripts that work (old ones) and the new ones what could cause this inconsistency. Any clues would be appreciated.
About the author
#2
02/21/2005 (5:43 pm)
Your best bet would be to post the script function(s) that don't work, and let us take a peek! Script is fine, just don't post any source code.
#3
Not sure if it's that hardcoded 40 but that doesn't seem like it should be the problem because otherwise it would never work if it were getting a 0 or something ....
02/21/2005 (5:47 pm)
Yeah I fixed it ... but it's really strange ... here are the differences ...// Doesn't work right
function CrossbowProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
// Apply damage to the object all shape base objects
if (%col.getType() & $TypeMasks::ShapeBaseObjectType)
{
%col.damage(%obj,%pos,%this.directDamage,"CrossbowBolt");
}
// Radius damage is a support scripts defined in radiusDamage.cs
// Push the contact point away from the contact surface slightly
// along the contact normal to derive the explosion center. -dbs
radiusDamage(%obj,%pos,%this.damageRadius,%this.radiusDamage,"CrossbowBolt",%this.areaImpulse);
}// Does Work
function CrossbowProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
// Apply damage to the object all shape base objects
if (%col.getType() & $TypeMasks::ShapeBaseObjectType)
%col.damage(%obj,%pos,%this.directDamage,"CrossbowBolt");
// Radius damage is a support scripts defined in radiusDamage.cs
// Push the contact point away from the contact surface slightly
// along the contact normal to derive the explosion center. -dbs
radiusDamage
(%obj, VectorAdd(%pos, VectorScale(%normal, 0.01)),
%this.damageRadius,%this.radiusDamage,"Radius",40);
}Not sure if it's that hardcoded 40 but that doesn't seem like it should be the problem because otherwise it would never work if it were getting a 0 or something ....
#4
1) Your %this.areaImpulse had a value of 0 possibly--which would mean no actual radius to act upon?
2) You also changed the next to last parameter from "CrossbowBolt" to "Radius"--again, not sure what the actual parameter is supposed to be, but could be possible this was the issue?
02/21/2005 (5:54 pm)
Two possible things:1) Your %this.areaImpulse had a value of 0 possibly--which would mean no actual radius to act upon?
2) You also changed the next to last parameter from "CrossbowBolt" to "Radius"--again, not sure what the actual parameter is supposed to be, but could be possible this was the issue?
Torque Owner Jeremy Alessi