Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, Ayumi, PeWi, Quad, VoroneTZ), 513 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Move entity towards player (pan+tilt) #448518
02/09/15 06:57
02/09/15 06:57
Joined: Jun 2013
Posts: 108
Alberta, Canada
C
CanadianDavid Offline OP
Member
CanadianDavid  Offline OP
Member
C

Joined: Jun 2013
Posts: 108
Alberta, Canada
I would like to move an object towards the player. The following works to adjust the pan of the object so that it moves in the player's direction:
Code:
vec_to_angle(my.pan,vec_diff(NULL,player.x,my.x));
c_move(me, vector(5 * time_step,0,0), nullvector, 0);

However, I can't quite seem to adjust the tilt so that the object also tilts towards the player as it moves forward. Any suggestions?

Re: Move entity towards player (pan+tilt) [Re: CanadianDavid] #448648
02/13/15 18:49
02/13/15 18:49
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
those code lines should move the entity towards the player. Any surrounding entity blocking the up and down movement? Missing IGNORE_PASSABLE or so?

Re: Move entity towards player (pan+tilt) [Re: txesmi] #448709
02/18/15 07:49
02/18/15 07:49
Joined: Jun 2013
Posts: 108
Alberta, Canada
C
CanadianDavid Offline OP
Member
CanadianDavid  Offline OP
Member
C

Joined: Jun 2013
Posts: 108
Alberta, Canada
Hi, thanks for the hint. I found the problem was because I was modifying the entity's position after immediately creating it but applying vec_to_angle(...) too soon before the entity had been moved.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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