| View previous topic :: View next topic |
| Author |
Message |
HolyForce How do I cheat?
Reputation: 0
Joined: 02 Dec 2012 Posts: 5
|
Posted: Sun Dec 02, 2012 5:05 am Post subject: Direction player is facing. |
|
|
Would anyone advise me with mathematics/tips on how player direction is usually implemented?
I'm doing various single player game "hacking" to practice some ASM and C++.
I am easily able to find X, Y and Z coordinates to teleport around the map. However, the direction one is facing is difficult. Often times I believe I find values related to it (because freezing them causes me to twitch), but I can never settle on some form of logic of how it works.
Any tips are appreciated. Thanks.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 474
Joined: 09 May 2003 Posts: 25956 Location: The netherlands
|
Posted: Sun Dec 02, 2012 5:33 am Post subject: |
|
|
Usually it's 2 or 3 variables
Horizontal axis (left<-->right)
Vertical axis (top<-->bottom)
And in some games the tilt
As for the logic it depends on the game engine.
Unreal for example stores the horizontal axis as a 2 byte value ranging from 0 to 65535, where 65536 is a full rotation
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
HolyForce How do I cheat?
Reputation: 0
Joined: 02 Dec 2012 Posts: 5
|
Posted: Sun Dec 02, 2012 6:34 am Post subject: |
|
|
| Dark Byte wrote: | Usually it's 2 or 3 variables
Horizontal axis (left<-->right)
Vertical axis (top<-->bottom)
And in some games the tilt
As for the logic it depends on the game engine.
Unreal for example stores the horizontal axis as a 2 byte value ranging from 0 to 65535, where 65536 is a full rotation |
Thanks, Dark Byte.
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Dec 02, 2012 2:41 pm Post subject: |
|
|
Another method I've seen in some 3D style games is storing the 'heading' value in a float as a radian.
_________________
- Retired. |
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sun Dec 02, 2012 4:54 pm Post subject: |
|
|
In XRayEngine games (S.T.A.L.K.E.R. ) there are radians too.
Up-Down angle is between 1.5 and -1.5
1.5 when looking down (85.94°)
0.0 when centered (0°)
-1.5 when looking up in the sky (-85.94°)
Left-Right angle - in 3D games, mostly, this is stored as radian, between -π and π. When you rotate ( counterclockwise ) it increases, from 0 up to π. After π is reached, it changes to -π. If you still rotate (counterclockwise) it increases from -π up to 0. (counterclockwise rotate - value is increasing)
XRayEngine Left-Right angle is radian too, But not closed in (-π,π) range. And value is increasing while clockwise rotate. So, you can see left-right angle for example as 30.0 radians (1718.87°). After quick-saving and quick-loading, it becomes -1.41 radians (-81.13°).
(1718.87° = 4*360° + 278,87° = 278,87°
278,87° - 360° = -81.13°)
_________________
|
|
| Back to top |
|
 |
|