Chapter 9.
by Alienforce · in Torque Game Engine · 10/06/2005 (1:44 pm) · 4 replies
Any one got any good tip for not having the swarm of bots get stuck even on open space they
seems to get stuck with eachother.
seems to get stuck with eachother.
#2
06/10/2006 (6:16 pm)
I've also noticed swarm beasties don't detect collisions. I've implemented this cludgy hack but I think there is a better way. I don't know how to get them to detect projectile collisions - any help would be good. This collision below is for a sword swipe or punch...I just don't like the weapon handling the player/enemy death and it shouldn't.%start = %player.getEyeTransform();
%end = VectorAdd(%start,%vec);
%found = ContainerRayCast (%start, %end, $TypeMasks::PlayerObjectType, %player);
// ~~~~~ if we got a target then damage it ~~~~~~~~~~~~~
if (%found>0)
{
// damage it
%foundObject = getword(%found,0);
if((%foundObject.getType() & $TypeMasks::PlayerObjectType) && %foundObject.getState() !$= "Dead")
{
%foundObject.applyDamage(%this.damage);
if (%foundObject.getState() $= "Dead")
{
%foundObject.playDeathCry();
%foundObject.playDeathAnimation();
%foundObject.setDamageFlash(0.75);
// Release the main weapon trigger
%foundObject.setImageTrigger(0,false);
// Schedule corpse removal. Just keeping the place clean.
%foundObject.schedule($CorpseTimeoutValue - 1000, "startFade", 1000, 0, true);
%foundObject.schedule($CorpseTimeoutValue, "delete");
}
}
}
#3
06/10/2006 (6:37 pm)
Well here's my second cludgy hack for projectile collisions on the swarm. They don't take radius collision damage for some reason. I put a break point in, in radiusDamage.cs and the code gets in there but the swarm beasties don't actually recieve damage.function Projectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
// Apply damage to the object all shape base objects
if (%col.getType() & $TypeMasks::ShapeBaseObjectType)
{
// damage it
if((%col.getType() & $TypeMasks::PlayerObjectType) && %col.getState() !$= "Dead")
{
%col.applyDamage(%this.directDamage);
if (%col.getState() $= "Dead")
{
%col.playDeathCry();
%col.playDeathAnimation();
%col.setDamageFlash(0.75);
// Release the main weapon trigger
%col.setImageTrigger(0,false);
// Schedule corpse removal. Just keeping the place clean.
%col.schedule($CorpseTimeoutValue - 1000, "startFade", 1000, 0, true);
%col.schedule($CorpseTimeoutValue, "delete");
}
}
else
{
%col.damage(%obj,%pos,%this.directDamage,"Fireball Damage");
}
}
// 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, "Radius", %this.areaImpulse);
}
#4
10/31/2006 (7:57 am)
THis doesn't seem to work very well.. they don't seem to follow each other and I get a ton of "friendless" results. Is that normal?
Torque Owner Alienforce
DLN
Time to put down the coffe and start typing :)