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 (AbrahamR, 7th_zorro, dr_panther, 1 invisible), 702 guests, and 6 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
Rotation questions #168284
11/19/07 21:06
11/19/07 21:06
Joined: Mar 2005
Posts: 12
R
Richey Offline OP
Newbie
Richey  Offline OP
Newbie
R

Joined: Mar 2005
Posts: 12
I am having a few problems getting to grips with rotations. I am trying to position an entity at an off set to another entity. If I want to place the child entity directly infront of the parent entity i use

Code:

var dir_x[3];
vec_for_angle(dir_x, parent.pan);
child.x = parent.x + (dir[0] * distance);
child.y = parent.y + (dir[1] * distance);
child.z = parent.z + (dir[2] * distance);



This positions the child 'distance' quants infront of the parent no matter what the rotation of the parent.

I cannot work out how to do this to place the child at the side or above the parent? I have tried rotation the direction vector (dir_x) using vec_rotate (dir_x, vector(90,0,0)) to make it face 'left' but although it starts in the correct location when I alter the tilt of the parent the child rotates around it in 2 axis?

Re: Rotation questions [Re: Richey] #168285
11/19/07 21:17
11/19/07 21:17
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
Hi,

you can do this with the following code:

var dir_x[3];
vec_set(dir_x, vector(distance, 0, 0));
vec_rotate(dir_x, parent.pan);
vec_add(dir_x, parent.x);
vec_set(child.x, dir_x);

Re: Rotation questions [Re: Fenriswolf] #168286
11/20/07 00:00
11/20/07 00:00
Joined: Mar 2005
Posts: 12
R
Richey Offline OP
Newbie
Richey  Offline OP
Newbie
R

Joined: Mar 2005
Posts: 12
Very useful. Thank you.

I've been playing around with that and it seems to be what I need.

If I am correct if I use vec_set(dir_x, vector(50,0,50)); I will get a point 50 quants ahead and 50 quants above?

Re: Rotation questions [Re: Richey] #168287
11/20/07 08:50
11/20/07 08:50
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
Quote:

If I am correct if I use vec_set(dir_x, vector(50,0,50)); I will get a point 50 quants ahead and 50 quants above?



Yes, exactly.


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