Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 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