ugh for a person that loves coding i hate math...

Discuss programming in the QuakeC language.
Post Reply
RooT
Posts: 40
Joined: Wed Sep 07, 2005 1:28 am

ugh for a person that loves coding i hate math...

Post by RooT »

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 :P 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>
My mod site!
Mod Status:
Turret Defense: 30%
UPS: 45%
MauveBib
Posts: 634
Joined: Thu Nov 04, 2004 1:22 am

Post by MauveBib »

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.....
Apathy Now!
Sajt
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Post by Sajt »

Might not want that to be called every frame :)
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Post by Wazat »

makevectors(self.owner.angles);
The projectile entity should have an avelocity something like '0 0 300'
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.
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.
RooT
Posts: 40
Joined: Wed Sep 07, 2005 1:28 am

thanks

Post by RooT »

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
My mod site!
Mod Status:
Turret Defense: 30%
UPS: 45%
Post Reply