Particle Effect Rotation In-Game
by Michael Mashayekh · in Torque Game Builder · 02/06/2009 (4:05 pm) · 1 replies
I was trying to control the rotation of a particle effect that I generate on the fly in game.
I use this code to generate it:
if(!isObject(Spray1))
{
%sg = %this.getScenegraph();
new t2dParticleEffect(Spray1);
Spray1.addToScene(%sg);
Spray1.loadEffect("./particles/waterSpray1.eff");
}
and then this to show the effect:
if(isObject(Spray1))
{
Spray1.setPosition($player.position);
Spray1.setRotation(60.0);
Spray1.playEffect(true);
Spray1.setVisible(true);
schedule(10000,0,TurnOffSpray);
}
Everything about this code works but Spray1.setRotation(60);
My effect remains at 0 degrees but if you do a getRotation on the effect, it has been set to 60 degrees.
When I make that effect in the TGB Level Editor, and set the rotation in the Scene Object drop down menu, the effect appears at the correct angle. Why won't it set the effect to the correct angle while in game?
I use this code to generate it:
if(!isObject(Spray1))
{
%sg = %this.getScenegraph();
new t2dParticleEffect(Spray1);
Spray1.addToScene(%sg);
Spray1.loadEffect("./particles/waterSpray1.eff");
}
and then this to show the effect:
if(isObject(Spray1))
{
Spray1.setPosition($player.position);
Spray1.setRotation(60.0);
Spray1.playEffect(true);
Spray1.setVisible(true);
schedule(10000,0,TurnOffSpray);
}
Everything about this code works but Spray1.setRotation(60);
My effect remains at 0 degrees but if you do a getRotation on the effect, it has been set to 60 degrees.
When I make that effect in the TGB Level Editor, and set the rotation in the Scene Object drop down menu, the effect appears at the correct angle. Why won't it set the effect to the correct angle while in game?
About the author
Torque Owner Michael Mashayekh
The game was looking for particle effect files in ./game/gamescripts rather than ./data/particles so I was putting them there manually when I was finished. I made some changes to my directional effect, and I forgot to move it to that folder.
Now I just need to figure out how to make the game target the right folder for particles :P