Gamestudio Links
Zorro Links
Newest Posts
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
2 registered members (AndrewAMD, Ayumi), 1,395 guests, and 4 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
How do I offset something reletive to an entitys.. #201184
04/07/08 12:50
04/07/08 12:50
Joined: Nov 2006
Posts: 193
England
RyuShinji Offline OP
Member
RyuShinji  Offline OP
Member

Joined: Nov 2006
Posts: 193
England
How do I offset something reletive to an entitys pan?

I want to put a sword on my players back for example, but the origin is on the handle of the sword, how can i move it right a bit in other words, how can i change its y pos relitive to the players y depending on the players pan..?

I want to offset the sword to the right by say 10, here is my current code:
vec_for_vertex(my.X,you,134); // get position of weapon
vec_set(my.pan,you.pan); // set pan to owner's pan
my.pan -= 90; // adjust weapon so player can see it better
my.tilt += 45; // adjust weapon so player can see it better

Last edited by RyuShinji; 04/07/08 14:44.
Re: How do I offset something reletive to an entitys.. [Re: RyuShinji] #201230
04/07/08 17:22
04/07/08 17:22

M
Malice
Unregistered
Malice
Unregistered
M



vec_set(temp,vector(0,5,0)
vec_for_vertex(my,temp2,134);
vec_add(temp,temp2);
vec_add(temp,player.x);
vec_set(my.pan,you,pan);


Does this work???

Last edited by Malice; 04/07/08 17:22.
Re: How do I offset something reletive to an entitys.. [Re: ] #201243
04/07/08 19:02
04/07/08 19:02
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
If you want to attach the sword to a certain vertex this instruction should do the job:
vec_for_vertex(sword.x,player,1234);
vec_set(sword.pan,player.pan);

If you have a certain offset (stored in the sword's skills) you could use this approach:
vec_set(temp.x,sword.offset_x);
vec_rotate(temp.x,player.pan);
vec_add(temp.x,player.x);
vec_set(sword.x,temp.x);
vec_set(sword.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