Gamestudio Links
Zorro Links
Newest Posts
Alpaca Plugin v1.5.2 Release
by kzhao. 01/11/26 13:42
Alpaca Plugin v1.4.0
by kzhao. 01/11/26 13:38
separating groups of 3 digits by a comma
by joe_kane. 01/11/26 00:01
MRC.c and WFO
by joe_kane. 01/10/26 23:58
BarOffset (default = 940 for daily bars?
by joe_kane. 01/10/26 23:46
NOMAX undeclared identifier.
by Petra. 01/09/26 21:12
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 2,814 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joe_kane, Namitha_NN, Syndrela, agasior, mosfet
19189 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Basic offsetting?? #252150
02/16/09 20:24
02/16/09 20:24
Joined: Nov 2006
Posts: 193
England
RyuShinji Offline OP
Member
RyuShinji  Offline OP
Member

Joined: Nov 2006
Posts: 193
England
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?

Re: Basic offsetting?? [Re: RyuShinji] #252183
02/16/09 23:19
02/16/09 23:19
Joined: Nov 2002
Posts: 913
Berlin, Germany
S
SchokoKeks Offline
User
SchokoKeks  Offline
User
S

Joined: Nov 2002
Posts: 913
Berlin, Germany
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

Re: Basic offsetting?? [Re: RyuShinji] #252232
02/17/09 09:34
02/17/09 09:34
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
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;


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1