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 


Help with Free-Look/Free-Roam hack

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Der5t
Newbie cheater
Reputation: 0

Joined: 10 Mar 2014
Posts: 14

PostPosted: Tue Jun 28, 2016 11:26 am    Post subject: Help with Free-Look/Free-Roam hack Reply with quote

I have been trying to make a 'free-look' hack for GTA Vice City.My Freelook hack is supposed to move the camera forward (where it is facing) after pressing 'W' key.I have the following needed stuff for this -

1. Camera position [X,Y,Z]
2. The position camera points at [X, Y, Z] (This position is usually the player co-ordinates)

Using the above data I was successful in making a 'first-person' hack(Check attachments for screenshot).I did that by noping the instruction writing to the camera location and setting a timer in lua which calls a function that would write to the camera location so that the camera is a little bit behind the object-camera-points-at (player).

After making that the idea of 'free-look' hack came to my mind.It needs some complex maths that I do not have knowledge of.
I need help in the math of Free-look.Any help will be appreciated.

---Extra Notes---

1.I doubt there is a XY look for the camera.It just points at a given XYZ co-ordinate and moving the mouse changes the camera XYZ position.But I will try to find the XY look.
2.On moving the mouse, the camera moves around in a circle with the centre being the object-camera-points-at.The difference between the object-camera-points-at and camera-location is the radius of the circle in which it performs the circular motion.
3.The object-camera-points-at by default is the core of the player.If inside a vehicle, the object-camera-points is the vehicle and the radius of the circle is big enough for seeing the complete vehicle.

This is what I could think the free-look hack should do.


In Free-Look.png(Check attachments),


Green dot = Camera Location
Black Dot = Object-Camera-Points-At
Grey Line = Object-Camera-Points-At - X AXIS
Purple Line = Object-Camera-Points-At Y AXIS

Blue Line = Radius of circular movement | Distance between camera and object-camera-points-at | Hypotenuse | =math.sqrt((GreyLine*GreyLine)+(PurpleLine*PurpleLine))

Orange Lines = Dividing the circle into 4 quadrants
Red Circle = Random Circle to make it look neat

Circle-Inside-Red-Circle = The path/pattern of the circular movement.NOTE: In the game, the CAMERA moves AROUND the OBJECT-IT-POINTS-AT.But in the algorithm it should not be much trouble.


In Free-Look2.png,

Grey Dot = Object-Camera-Looks-At extended with the Hypotenuse after pressing W key.


In Free-Look3.png,

Pink Dot = extension of Camera-Position along Hypotenuse the same units as the extension of Grey Dot (Object-Camera-Points-At)

------------------------
This concept should make a 2D free-look hack which will work perfectly.I just need the keep the radius (hypotenuse) as small as possible.

So according to this if I move the mouse, the camera should look around and when I press 'W' key, both the camera and object-camera-points-at should move a few units along the hypotenuse.

All I need help in is math help in extending the object-camera-points-at along the hypotenuse.Any help will be appreciated.



Free-Look 3.png
 Description:
Free-Look 3.png
 Filesize:  5.35 KB
 Viewed:  10901 Time(s)

Free-Look 3.png



Free-Look 2.png
 Description:
Free-Look 2.png
 Filesize:  5.2 KB
 Viewed:  10901 Time(s)

Free-Look 2.png



Free-Look.png
 Description:
Free-Look.png
 Filesize:  12.53 KB
 Viewed:  10901 Time(s)

Free-Look.png


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4695

PostPosted: Tue Jun 28, 2016 12:46 pm    Post subject: Reply with quote

Google "trigonometry". You can simplify this case to the point where you don't need to use any trigonometric functions (i.e. sin, cos, atan) for a basic 2D freecam script. Here's an example:
Code:
freeCamEnabled = true
freeCamSpeed = 1.0
createNativeThread(function(thread)
    while freeCamEnabled do
      local oxc, oyc = readFloat("cameraX"), readFloat("cameraY")
      local oxt, oyt = readFloat("targetX"), readFloat("targetY")
      local hyp = math.sqrt((oxt-oxc)*(oxt-oxc)+(oyt-oyc)*(oyt-oyc))
      local dx, dy = 0, 0
      if isKeyPressed(VK_W) then
        dx = dx + (oxt - oxc) / hyp
        dy = dy + (oyt - oyc) / hyp
      end
      if isKeyPressed(VK_S) then
        dx = dx - (oxt - oxc) / hyp
        dy = dy - (oyt - oyc) / hyp
      end
      if isKeyPressed(VK_A) then
        dx = dx - (oyt - oyc) / hyp
        dy = dy + (oxt - oxc) / hyp
      end
      if isKeyPressed(VK_D) then
        dx = dx + (oyt - oyc) / hyp
        dy = dy - (oxt - oxc) / hyp
      end
      writeFloat("cameraX", oxc + dx * freeCamSpeed)
      writeFloat("cameraY", oyc + dy * freeCamSpeed)
      writeFloat("targetX", oxt + dx * freeCamSpeed)
      writeFloat("targetY", oyt + dy * freeCamSpeed)
      sleep(20)
    end
  end)

You may need to mess around with the signs of the changes to your x/y coordinates to get everything moving in the right direction (e.g. invert D/A keys), but the basic concepts are the same.

_________________
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
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Tue Jun 28, 2016 4:42 pm    Post subject: Reply with quote

Writing this hack in LUA seems easier on the surface but after writing a couple of camera free fly mods.

http://forum.cheatengine.org/viewtopic.php?t=585412&postdays=0&postorder=asc&start=0

http://forum.cheatengine.org/viewtopic.php?t=587352

I can say that the drawback with Lua is the smooth operation of the camera. Lua is slow AF to write values back to the game vs injecting new code. You will have a jittery camera most likely. Eitherway both links I have written camera free fly mods in and the scripts are well labeled and easy to understand. Goodluck

_________________
Back to top
View user's profile Send private message
Der5t
Newbie cheater
Reputation: 0

Joined: 10 Mar 2014
Posts: 14

PostPosted: Tue Jun 28, 2016 5:06 pm    Post subject: Reply with quote

Thank you both for your help! I will try making the free-cam. Smile
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