Scripts / Entity Angles?

Author
Message
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 29th Jan 2021 19:56 Edited at: 29th Jan 2021 20:02
Having trouble getting the current angles of the entity.

Text(10, 15, 1, GetEntityAngleY ( e ) ) -- returns '270'
Text(10, 20,1, GetObjectAngleY (obj) ) -- returns '0'

**Does NOT show any change**,
even though the entity is rotating clockwise continuously, one complete rotation
approx every 5 seconds...?

Text(10, 25,1, "current angle; "..g_Entity[e]['angley'] )
returns a value in the range of 20 and -20 ?!
even though the entity is rotating clockwise continuously, one complete rotation
approx every 5 seconds...?

These are weird anomalies. Can I find the 0-360 degree value and work with it?
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 29th Jan 2021 20:12
Changed GetObjectAngleY (obj) )

with GetObjectAngleY (g_Entity[e]['obj']) )

just shows the same entity match of 20 to (-20) any suggestions?
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Jan 2021 20:33
Probably because the object is not rotating around the world Y axis, is it tilted?
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 29th Jan 2021 20:53 Edited at: 29th Jan 2021 20:54
Using PushObject to rotate...

Now to find angles, trying to use;
uprx[e], upry[e], uprz[e] = UpdateEntityRT(e,,,,,,rx,ry,rz,,,,,,,,,,,,,)

with error ... 'Unexpected symbol near ,'

for sure the (e part is necessary, so how would you go about bypassing the 'e'?)
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Jan 2021 21:01
UpdateEntityRT?

Wth is that?
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Jan 2021 21:05
Btw there is a function in physlib called getRealWorldYangle which you can copy to turn Euler angles into world Y angle.
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 29th Jan 2021 21:21
function UpdateEntityRT(e,object,x,y,z,rx,ry,rz,ave,act,col,key,zon,ezon,plrvis,hea,frm,pdst,avd,lmb,lmi)
g_Entity[e]['x'] = x;
g_Entity[e]['y'] = y;
g_Entity[e]['z'] = z;
g_Entity[e]['anglex'] = rx;
g_Entity[e]['angley'] = ry;
g_Entity[e]['anglez'] = rz;
g_Entity[e]['obj'] = object;
g_Entity[e]['active'] = ave;
g_Entity[e]['activated'] = act;
g_Entity[e]['collected'] = col;
g_Entity[e]['haskey'] = key;
g_Entity[e]['plrinzone'] = zon;
g_Entity[e]['entityinzone'] = ezon;
g_Entity[e]['plrvisible'] = plrvis;
g_Entity[e]['health'] = hea;
g_Entity[e]['frame'] = frm;
g_Entity[e]['plrdist'] = pdst;
g_Entity[e]['avoid'] = avd;
g_Entity[e]['limbhit'] = lmb;
g_Entity[e]['limbhitindex'] = lmi;
end
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 29th Jan 2021 21:25
Does GetObjectAngleY (g_Entity[e]['obj']) )
use euler angles?
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Jan 2021 21:56
UpdateEntityRT is not for the user, it is called by the engine to update the global variables!

All angles are world Euler angles.

What you need are entity relative angles which you cannot get from the engine, you need to use a bit of math to work them out.

Hence the function I mentioned above.

Here is a version you can drop into your own script.

Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 30th Jan 2021 20:50
Thanks. That works, but only if I manually rotate the entity via SetRotation commands.
But that resets all live parameters. The goal is to use PushObject
I need angle updates real time as the object moves about objects and terrain, etc.
How can I get this information? Doesn't bullet engine feed this to GG engine?
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 31st Jan 2021 00:06
Yes, use GetObjectPosAng or GetEntityPosAng to get the position and angles directly.

i.e.:
local x, y, z, xa, ya, za = GetEntityPosAng( e )

Then get the 'real world' Y angle with:

rwy = GetRealWorldYangle( xa, ya, za )

Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 31st Jan 2021 00:56
Okay, thanks. I should have gave that one a try.
PM

Login to post a reply

Server time is: 2024-12-22 02:07:34
Your offset time is: 2024-12-22 02:07:34