Game Development Community

Tied a particle in a player

by Marcus Araujo · in General Discussion · 01/16/2008 (5:44 am) · 4 replies

How can I tie a particle in a player?

For example: I'm hit with a sword and I need some blood on the player wherever he go.

I'm using torque 1.5.2 on Windows XP.

#1
01/16/2008 (6:31 am)
Are you talking about an arbitrary mount point for a particle on your mesh (for example, being shot in the throat to spew blood as you wander about before dying) or about staining the texture with blood (get cut, spatter shirt)? Either one will require some changes to the source, I believe. I think there is a resource for arbitrary mount points, but I don't recall if it is for 1.5.2. It seems like it was for 1.3 and sketchy in the reliability front, but I could be mistaken. It's been a long time.
#2
01/16/2008 (6:37 am)
Yes there is a using nodes for mounting particles resource. It does work well in 1.5.2. Sorry i dont have the link off hand.
#3
01/16/2008 (7:06 am)
I'm talking some blood apears on the player in a few time, like a smok on the player. Just this.

I try this but only appears on the position of the player, I need this blood "follow" the player, like a smok in the player.

Look this code, I try, but dont work.

//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
#4
01/16/2008 (7:22 am)
There is a forum search function. The Resource section have at least 2 examples of how to do this. Its a common question, a little research should find the answer.