Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
johnfulgor

GZDoom: GetActorAngle not working with player

Recommended Posts

Hello all,
it seems that GetActorAngle returns always 0 when called with the player TID ...
#include "Zcommon.acs"
script 1 OPEN
{

int angle=GetActorAngle(2); /*Player TID is 2*/
print(f:angle); /*Always zero, whichever the orientation is*/
delay(100);
angle=GetActorAngle(1); /*Other Object TID is 1*/
print(f:angle); /*This is OK*/


}

PLAYER and second object are facing the exact same direction, and are still, but GetActorAngle return different values ...
Thanks all!

Share this post


Link to post

Make it an ENTER script, so it's guaranteed to run when the player enters the game, not when the map is loading. I had a similar problem a few weeks ago.

With the ENTER script, you could give your player a TID and get his angle in one script. This is assuming you need the player TID to be a global value for other scripts:

#include "zcommon.acs"
#define PlayerTID 2
script 1 ENTER
{
    Thing_ChangeTID(0, PlayerTID);
    int angle = GetActorAngle(PlayerTID);
    print(f:angle);
    /* do whatever you need with the angle here */
}
Hope this helps!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×