Game Development Community

Problem with Blood on the player

by Marcus Araujo · in Technical Issues · 01/16/2008 (3:57 am) · 4 replies

Hi Folks,

I have some problems with add a particle in a player. I try this code:


//ON SERVER
datablock ParticleData( FireParticle )
{
textureName = "~/data/shapes/blood/blood";
dragCoefficient = 0.0; //0.0
gravityCoefficient = -0.9;
inheritedVelFactor = 0.0;
//useInvAlpha = false;
spinRandomMin = -90.0;
spinRandomMax = 90.0;

lifetimeMS = 450;
lifetimeVarianceMS = 90;

times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;

//Red color
colors[0] = "0.5 0.0 0.0 0.0";
colors[1] = "0.5 0.0 0.0 0.4";
colors[2] = "0.5 0.0 0.0 0.0";

sizes[0] = 0.5; //0.5
sizes[1] = 0.5; //0.5
sizes[2] = 1.2; //1.2
};
datablock ParticleEmitterData( FireParticleEmitter )
{
particles = "FireParticle";

ejectionPeriodMS = 50;
periodVarianceMS = 1;

ejectionVelocity = 1.0;
velocityVariance = 0.5;

thetaMin = 0;
thetaMax = 35;
lifetimeMS = 450;
};
datablock ParticleEmitterNodeData( FireParticleEmitterNode )
{
timeMultiple = 1;
};

function showBlood(%target,%client){
commandToClient(%client.client, 'GetNewPlayerPosition',%target);
}

function serverCmdBlood(%client, %position){
new ParticleEmitterNode(FIRE){
dataBlock = "FireParticleEmitterNode";
emitter = "FireParticleEmitter";
position = %position;
rotation = "1 0 0 0";
scale = "1 1 1";
count = 0;
};
schedule(1000, 0 ,"stopBlood");
}

function stopBlood()
{
if (isObject(FIRE)) FIRE.delete();
}
//END ON SERVER

//ON CLIENT
function clientCmdGetNewPlayerPosition(%target){
commandToServer('Blood',%target.position);
}
//END ON CLIENT

But only work on the local when the player was hit, the particle dont follow the player. All I want is this particle in the player where he go.

I'm using torque version 1.5.2 on the Windows Xp SP2.

#1
01/16/2008 (5:20 am)
This is because you are passing the player position when he got hit... not asking to the particle to follow the player... you have to try to attach the particle to a player node so it will follow the player.
#2
01/16/2008 (6:32 am)
Yeah! That is all I want! How can I make it work?
#3
01/16/2008 (8:11 am)
Do a forum search for "mounted particles"
#4
01/16/2008 (9:35 am)
Said functionality can also be done really easy using AFX. I know its where sterotypical, but AFX i sure worth its money.