Game Development Community

ParticleErmitterNode collision

by CodingChris · in Torque Game Engine · 12/10/2007 (6:39 am) · 0 replies

Hi,
I've a little problem. What I want do: Create a ParticleErmitterNode and ever the player collides with this node I want him to get damged. My code:
function MolotovProjectile::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,"MolotovProjectile");

   // 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);
	  %par = new ParticleEmitterNode() {
	  datablock = Burner;
      canSaveDynamicFields = "1";
      position = %pos;
      rotation = "1 0 0 0";
      scale = "1 1 1";
      dataBlock = "RealFireNode";
      emitter = "MolotovSparksEmitter";
      velocity = "1";
   };
}
ParticleEmitterNode(Burner) {
   
      dataBlock = "RealFireNode";
      emitter = "MolotovSparksEmitter";
      velocity = "1";
   };
function Burner::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,"MolotovProjectile");

   // 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);
	 
}
What is wrong here?