Move entity towards player (pan+tilt)

Posted By: CanadianDavid

Move entity towards player (pan+tilt) - 02/09/15 06:57

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?
Posted By: txesmi

Re: Move entity towards player (pan+tilt) - 02/13/15 18:49

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?
Posted By: CanadianDavid

Re: Move entity towards player (pan+tilt) - 02/18/15 07:49

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.
© 2024 lite-C Forums