Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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 | chip programmers | 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