Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
turn towards object in 3D space #298830
11/18/09 09:12
11/18/09 09:12
Joined: Sep 2009
Posts: 12
Y
Yourself Offline OP
Newbie
Yourself  Offline OP
Newbie
Y

Joined: Sep 2009
Posts: 12
hi,

I'm making an space kinda game and I want some enemies to turn straight at you. the problem is that he turns correct but only in the xz-plane.
So if I'm above the enemy, he doesn't know that and doesn't adjust his tilt....

Code:
// enemy action, ppos == position player
my.pan -= sign(ang(180 + my.pan - ppos.x)) * 5 * time_step;
my.tilt -= ?????



any help with this please ?

thx

Re: turn towards object in 3D space [Re: Yourself] #298847
11/18/09 12:26
11/18/09 12:26
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey

VECTOR direction;
ANGLE angle_to_player;
vec_set(direction,my.x);
vec_sub(direction,ppos.x);
vec_to_angle(angle_to_player,direction);
vec_set(my.pan,angle);


3333333333

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