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.
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.
About the author
Torque Owner UZON