Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Camera moving forward in the direction is facing

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
chibs1441
How do I cheat?
Reputation: 0

Joined: 03 Aug 2021
Posts: 4
Location: a secret

PostPosted: Mon Apr 25, 2022 1:19 pm    Post subject: Camera moving forward in the direction is facing Reply with quote

Hello! I have been working on a FreeCam cheat for a while and I need to make it move in the direction it's facing. As far as I know I can apply some math for that to happen, tried many things but none of them work. If I could get any help that would be awesome.

Code:

bytes = "F2 0F 11 4A 03 8B ?? C0 F2 0F 10 4A 03 8B ?? 0F F2 0F 11 4A 03 8B ?? ?? F2 0F 10 4A 03 8B ?? 13 F2 0F 11 4A 03 F2"
results = AOBScan(bytes,"*W*X-C")
if (results==nil) then
messageDialog("Error!", 1,2)
return end
address=getAddress(stringlist_getString(results,0))
debug_setBreakpoint(address)
function debugger_onBreakpoint()
Y = EDX + 0x03
X = EDX + 0x03 + 0x10
Z = EDX + 0x03 + 0x20
debug_removeBreakpoint(address)
return 1
end
lenghtLines = stringlist_getCount(results)
for i = 0, lenghtLines-1 do
address = tonumber('0x' .. stringlist_getString(results, i))
writeBytes(address, 0x90, 0x90, 0x90, 0x90, 0x90)
writeBytes(address + 16, 0x90, 0x90, 0x90, 0x90, 0x90)
writeBytes(address + 32, 0x90, 0x90, 0x90, 0x90, 0x90)
end
messageDialog("Actiavted!", 2,2)

function TimerFunc7()
 if (isKeyPressed(VK_A)) then
writeDouble(Y,readDouble(Y)+50)
end

 if (isKeyPressed(VK_D)) then
writeDouble(Y,readDouble(Y)-50)
end

 if (isKeyPressed(VK_S)) then
writeDouble(X,readDouble(X)+50)
end

 if (isKeyPressed(VK_W)) then
writeDouble(X,readDouble(X)-50)
end

 if (isKeyPressed(VK_J)) then
writeDouble(Z,readDouble(Z)+50)
end

 if (isKeyPressed(VK_K)) then
writeDouble(Z,readDouble(Z)-50)
end

end

if (timerobj7 ~= nil) then
timerobj7.destroy()
end

timerobj7 = createTimer(nil)
timer_onTimer(timerobj7 ,TimerFunc7)
timer_setInterval(timerobj7 , 1)
timer_setEnabled(timerobj7 , true)

_________________
--sample text--
Back to top
View user's profile Send private message AIM Address
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Mon Apr 25, 2022 2:29 pm    Post subject: Reply with quote

You need to modify all 3 components of your x/y/z coordinates. This involves transforming the vector you want to move in from your relative coordinates into the world's coordinates. This is covered in linear algebra, but a precalculus course also goes over the basics of vectors and trigonometry.
You'll also need to get the direction you're facing. This might be represented as euler angles or a quaternion.

Also:
  • Indent your code
  • Stop using legacy methods (e.g. prefer `results.Count` to `stringlist_getCount(results)`)
  • Use a local breakpoint handler instead of the global handler
  • Destroy the aobscan results
  • Restrict the regions scanned by aobscan to executable if you're looking for executable code
  • `if obj then` is more conventional than `if obj ~= nil then`
  • The movement will probably be more smooth if you hook into the game's code and change coordinates in assembly than if you try to do it through a timer. (the timer still writes speed values into the game's memory which the code injection uses)
  • Might be other stuff; I didn't look at your code too closely b/c reading unindented code is annoying
See celua.txt for more information. There's a CE wiki that might also be useful

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Frouk
Master Cheater
Reputation: 5

Joined: 22 Jun 2021
Posts: 489
Location: mov dword ptr [Ukraine]

PostPosted: Tue Apr 26, 2022 12:47 am    Post subject: Reply with quote

ParkourPenguin wrote:
You need to modify all 3 components of your x/y/z coordinates. This involves transforming the vector you want to move in from your relative coordinates into the world's coordinates. This is covered in linear algebra, but a precalculus course also goes over the basics of vectors and trigonometry.
You'll also need to get the direction you're facing. This might be represented as euler angles or a quaternion.

Also:
  • Indent your code
  • Stop using legacy methods (e.g. prefer `results.Count` to `stringlist_getCount(results)`)
  • Use a local breakpoint handler instead of the global handler
  • Destroy the aobscan results
  • Restrict the regions scanned by aobscan to executable if you're looking for executable code
  • `if obj then` is more conventional than `if obj ~= nil then`
  • The movement will probably be more smooth if you hook into the game's code and change coordinates in assembly than if you try to do it through a timer. (the timer still writes speed values into the game's memory which the code injection uses)
  • Might be other stuff; I didn't look at your code too closely b/c reading unindented code is annoying
See celua.txt for more information. There's a CE wiki that might also be useful


also xyz must be close enough to each other, double each 0x8 bytes, float each 0x4 bytes

_________________
void(__cdecl *Haxing)(HWND hGameWindow)
Back to top
View user's profile Send private message
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 96

PostPosted: Fri Jun 03, 2022 9:14 pm    Post subject: Reply with quote

Check this link

https://www.cheatengine.org/forum/viewtopic.php?t=610559

You probably lack the knowledge of 3D programming, if you interested in the math behind it,you should check learnopengl,camera part and see how it goes.

https://learnopengl.com

https://learnopengl.com/Getting-started/Camera

Otherwise,you should find a freecamera Cheat Table already exists on internet for a quick reference.There should be KOF14,Street Fighter 5 freecamera exist and see how they work.

You don't need to know the math behind it,you just need to know how to use it correctly,which means,replace the Position and Facing Vector or other things memory address to your game address and disable it's original update if they use similar game engine.

If you want an FPS camera without Roll Rotation,Vector3D and Trigonometry are all you need to know.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites