Game Development Community

Impact particle effect

by Tahitian Lucas-box · in Torque Game Engine · 12/16/2004 (2:06 am) · 4 replies

HI, i am working on a game idea and would like to add an effect whereby when the player, or ai for that matter, hit the floor at a fast enough velocity, a quick 'explosion' of smoke occurs.
I was thinking that i could either
1) link this to the ground shake, but i dont know how to go about changing the emmitter during the game via script.
2) somehow write a new bit of script to know when the player has hit the floor hard enough.

p.s. is there a way of knowing how hard the player has hit the floor? using script?

#1
12/17/2004 (12:35 pm)
I'd go with 2... then create a node when this happens
#2
06/30/2008 (8:39 am)
For any other looking for a script to implement this. In player.cs make sure you have a

datablock ParticleEmitterNodeData(defaultParticleEmitterNode)
{
timeMultiple= 1.0;
};

then find the function
Armor::onImpact(%this, %obj, %collidedObject, %vec, %vecLen)
in side that function add to it
%Test= new ParticleEmitterNode() 
   {			
      position = %obj.getTransform() ;			
      rotation = "1 0 0 0";			
      scale = "1 1 1";			
      dataBlock = "defaultParticleEmitterNode";			
      emitter = "CrossbowDebrisSparkEmitter";			
      velocity = "1";	
      };
  MissionCleanup.add(%Test);

}
and have fun with the splatter effects
#3
06/30/2008 (9:09 am)
Actually wouldnt it be easier just to make the camera shake instead of the ground? when something hits the ground. simply, add a collision with the terrain, camera shake and add particle emmiter. (im not a programmer, but this would seem to be a logical process with the least amount of hassle) you would need to measure the speed of the impact needed to trigger the event but.. other then that. i think thats all you need accordingto what your asking for.
#4
07/27/2008 (3:25 pm)
There is already code in the engine for most of this. When the player falls from a high enough point and hits the ground, an animation called "Land" is played and the player is frozen for a second and the camera shakes.