math... failed it 3 times already hah... well some help here may not only improve my mod but help me pass a simple math test wondering if there is any math function asociated with spirals/helix circles or waves. what im looking for is a script that will cause an object to move foward but also spin around a center point. the point is to make a trail fallow this object leaving a spiral pattern. any other way this can be donw would also work so let me know. thanks!
-Root one
<9/11 today, give a thought>
ugh for a person that loves coding i hate math...
I assume you mean to make a trail follow a projectile while spinning round it, to leave a spiral effect like a railgun?
For that, the easiest way is to have to the trail as an entity, with it's owner set to the projectile;
The projectile entity should have an avelocity something like '0 0 300'
The think function of the trail entity should be something like:
void() trail_think =
{
if (!self.owner)
{
remove(self);
return;
}
makevectors(self.owner.angles);
setorigin(self, self.owner.origin + v_right * 10);
particle(self.origin, '0 0 0'. 14, 4);
self.nextthink = time;
};
Of course the particle() line should be changed for whatever trail effect you're after, or if it's a model flag trail effect then obviously you don't need a qc line for it at all.
This is untested of course.....
For that, the easiest way is to have to the trail as an entity, with it's owner set to the projectile;
The projectile entity should have an avelocity something like '0 0 300'
The think function of the trail entity should be something like:
void() trail_think =
{
if (!self.owner)
{
remove(self);
return;
}
makevectors(self.owner.angles);
setorigin(self, self.owner.origin + v_right * 10);
particle(self.origin, '0 0 0'. 14, 4);
self.nextthink = time;
};
Of course the particle() line should be changed for whatever trail effect you're after, or if it's a model flag trail effect then obviously you don't need a qc line for it at all.
This is untested of course.....
Apathy Now!
makevectors(self.owner.angles);
Actually, you can give the trail entity an avelocity instead, if for whatever reason it wouldn't be desirable to make the projectile spin. Or, you might want the projectile spinning in a different way (like a lavaball with avelocity '300 300 500'). Also make sure to set the trail entity's angles when it's fired.The projectile entity should have an avelocity something like '0 0 300'
Giving the trail entity avelocity and doing makevectors(self.angles); instead of on self.owner.angles will probably work better for you.
Now instead of calling the particle command, make a model that has nothing in it (a null model) and give it the rocket or grenade trail effect. Other effects to try are the vore trail and wizard trail. With the trail entity set to this special model, the trail will be created automatically, so you won't have to worry about calling the think function every frame (particles can be a real problem if you have too many).
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
thanks
actualy yes i was making a railgun hah i guess that spining trail is overused... but thanks ill give this a try, btw another wuestion, how do i get the rail to go through things? movetype_noclip with solid_trigger? just guessing