Posted: Sun Jan 17, 2016 5:36 pm Post subject: Free Fly Camera
Does anyone have experience with creating this type of cheat? I've whipped up the follow and it works great, but I am unsure on how to always make the directions move according to the camera facing position. Lets say I have the following
Code:
Camera X
Camera Y
Camera Z
Camera H Rotation
Camera V Rotation
How would one go about making the camera move "Forward" (8), "Back" (2), "Left" (4), and "Right" (6) based on that information? Please forgive the sloppy coding as it is currently in a WIP state. Any help is appreciated.
If the ground is the X Y plane, Z points upward, and Camera V angle is 0 when you look at the horizon, you move the camera forward by adding:
Speed*cos(Camera H angle)*cos(Camera V angle) to x
Speed*sin(Camera H angle)*cos(Camera V angle) to y
Speed*sin(Camera V angle) to z
To move to the left side, add:
Speed*sin(Camera H angle) to x
Speed*cos(Camera H angle) to y
For sin/cos calculation, you can use the fsin/fcos/fsincos instructions (warning: they use angles in radians, so one full turn = 2*pi ~= 6.28 ). _________________
DO NOT PM me if you want help on making/fixing/using a hack.
Please forgive me if I'm wrong but I think you shouldn't dealloc your memory in the [DISABLE] section. The thread will almost certainly access that freed memory causing a segmentation fault and crashing the process. This topic has info on how to dealloc memory a thread is using in an AA script.
Besides that, your current code is clean and readable, but it could have a few optimizations here and there, especially with the jumps. Side note: you could also use Lua to do this if you wanted to by using createHotkey(...), createTimer(...), and read/writeFloat(...).
I'm guessing the camera is in a rectangular coordinate system relative to the world you're in, and not relative to your player. If you'd like to make the camera move relative to the direction your camera is facing, then you should be able to use trigonometry to do it by multiplying the [modifier] constant by the sin or cos of the rotation values (as Gniarf said). Note that you'll also need to modify your current code a fair bit to do this because you'll probably be changing more than 1 address at a time. _________________
I don't know where I'm going, but I'll figure it out when I get there.
If the ground is the X Y plane, Z points upward, and Camera V angle is 0 when you look at the horizon, you move the camera forward by adding:
Speed*cos(Camera H angle)*cos(Camera V angle) to x
Speed*sin(Camera H angle)*cos(Camera V angle) to y
Speed*sin(Camera V angle) to z
To move to the left side, add:
Speed*sin(Camera H angle) to x
Speed*cos(Camera H angle) to y
For sin/cos calculation, you can use the fsin/fcos/fsincos instructions (warning: they use angles in radians, so one full turn = 2*pi ~= 6.28 ).
This is a perfect description of the xyz setup for this game. I will start with this and see where it takes me.
ParkourPenguin wrote:
Please forgive me if I'm wrong but I think you shouldn't dealloc your memory in the [DISABLE] section. The thread will almost certainly access that freed memory causing a segmentation fault and crashing the process. This topic has info on how to dealloc memory a thread is using in an AA script.
Besides that, your current code is clean and readable, but it could have a few optimizations here and there, especially with the jumps. Side note: you could also use Lua to do this if you wanted to by using createHotkey(...), createTimer(...), and read/writeFloat(...).
I'm guessing the camera is in a rectangular coordinate system relative to the world you're in, and not relative to your player. If you'd like to make the camera move relative to the direction your camera is facing, then you should be able to use trigonometry to do it by multiplying the [modifier] constant by the sin or cos of the rotation values (as Gniarf said). Note that you'll also need to modify your current code a fair bit to do this because you'll probably be changing more than 1 address at a time.
I'll check out the Lua method you speak of as it may be a little easier to get going (then I can convert the finished product back to asm for speed). I will also look into correcting that dealloc issue when I get a chance (thanks for pointing that out).
Thank you both for taking the time to reply as I haven't seen many topics on this type of cheat. Do either of you happen to know of any existing x86 code examples for free fly cameras in other games that I may use for reference? _________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc...
I fought with this something like this just recently.
What exactly are you working with.
Do you have the degrees of rotation only?
Do you have the the sin and cos values already located. They are definitely in the code some where after the degrees of rotation.
If you have the cos and sin values then its just vector calculus.
The implementation is kinda of vitch though.
Keep us updated.
I'm working with Resident Evil 4 Ultimate HD Edition, and currently have the xyz of the camera along what I assumed to be a read only version of the H and V rotations (horizontal goes from -2 to 2 and vertical from -1 to 1 due to how the camera look limits works in this game from the character prespective). Usually when you find the camera structure, you have xyz, h/v rotations, zoom, etc... but this game is odd in the fact that it doesn't appear to be all in a nice little bundle for me. I haven't had a chance to look at it any further due to work, but I intend to return to this game when I get some time. Do you happen to own this game? _________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc...
Vertical of -1 to 1 is what you need. either way this is secondary. The math for this is simple.
Horizontal of -2 to 2 is weird. It could be doubled for some reason but it most likely cos or sin.
HInts
there should be sin and cos values located in the stack if its x87 code or the cos and sin should be in xmm.
Basically to get a 3rd person camera its zoom * cosine + x coord then its zoom * sine - y coord.
- This might help in tracking where the sin and cosine values are located
To get the camera to move according to facing direction you will need both of these values.
Or you will have to decipher what -2 to 2 is then arcsin to get back to rotation in degrees then recalculate sine and cosine. LOL NO F%%% that
There really is no reason to calculate with fsin or fcos unless you really cant track down the games values.
Implementing The Code goes like so.
Lets say the camera is facing 23 degrees and you want to move forward.
cos(23) is .9205
sin (23) is .3907
camera X Y coords are X = 100 Y = 2000
So you if wr to multiply your rate of movement lets say 5 by cosine you get 4.025 + X camera location = 104.025
Rate (5) * sin(23) = 1.9535 + Y of camera location = 2001.95
as cycles accumulate. You get
1st cycle 104.025
2nd 108.05
3 112
4th 116
etc...
Thats basic movement in euclidean space. Vector Calculus
Damn that looks nice. I still haven't gotten a chance to look back into this yet due to a hectic work schedule, but that is very impressive. Do you happen to have a link to the script used for flying around? Again, very nice work. _________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc...
movss xmm15,[rdi-18] // Z pitch
mulss xmm15,[Fly_Rate]
/// xmm11 is Z coord
subss xmm11,xmm15
xorps xmm15,xmm15 /// clearing xmm // is used for other camera shit
movss [rdi+38],xmm11 // forcing Z height to write to camera Map location
jmp originalcode
originalcode:
movss [rdi+30],xmm6 // writing xmm6 value to camera Map location
//movss [rdi+34],xmm8 // this is normally after my injection point just
//included for reference,
jmp return
Now onto the adventure of gathering the remaining elements to make this hack possible. I've sent you a pm pertaining to a new location I've found that may hold the additional values I'm looking for. Thanks for posting the script (didn't think it would be that short heh). _________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc...
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum