Basic offsetting??

Posted By: RyuShinji

Basic offsetting?? - 02/16/09 20:24

I've had this problem for a while, always just made a cheap version that never really worked.

How do I offset a entity like a bullet slightly infront of anouther entity like the player reletive to the players pan?
Posted By: SchokoKeks

Re: Basic offsetting?? - 02/16/09 23:19

just do some math...

or do it the lazy way:
[code]
vec_for_angle(temp,player.pan);
// get unity vector out of player.pan
vec_scale(temp, 100);
// and extend him 100 quants
[\code]
this code sets temp 100 quants infront of the player entity
Posted By: George

Re: Basic offsetting?? - 02/17/09 09:34

Here's another version that allows you to set offsets on all the axis:

vec_set (bullet.x, vector (100, -50, 20)); // place the bullet 100 quants in front, 50 quants sideway, 20 quants above the origin
vec_rotate (bullet.x, player.pan);
vec_add (bullet.x, player.x);
bullet.pan = player.pan;
© 2023 lite-C Forums