Forum: Grand Theft Auto Series Modding - Our GTA Modding Team is the best around. Tutorials & Topics related to modding your GTA games, trophies, and save files! Discuss GTA game modding with the knowledgeable members of PSX-Scene and the Official GTA IV Mod Team.


The above video goes away if you are a member and logged in, so log in now!




 
Would you like to get all the new info from
PSX-Scene in your email each day?




Want to learn more about the team keeping you up to date with the latest scene news?

Read about them now!

Check out our Developer bios, too!

 


User Tag List

Like Tree4Likes
  • 2 Post By Three-Socks
  • 2 Post By jumper

Thread: Any way to GET the game cam PITCH?
  

Results 1 to 6 of 6
  1. #1 Question Any way to GET the game cam PITCH? 
    jumper's Avatar
    jumper is offline Developer
    Join Date
    Jul 2005
    Posts
    289
    Downloads
    3
    Uploads
    0
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    74
    Likes Received
    207
    So I have an idea for a cool offline script that would use SET_GAME_CAM_PITCH and SET_GAME_CAM_HEADING among other things, but I need to get the pitch data while in-game (on foot, and aiming a gun).

    Three socks xyzh example gives me everything I need but the pitch, and after looking at the natives I don't see a way to GET this data so it can be printed to screen. The example uses GET_CHAR_HEADING for the heading, but as far as I can see there is no GET_CHAR_PITCH or GET_GAME_CAM_PITCH, or anything along those lines. The closest I can see that might be useful are GET_GAME_CAM and GET_GAME_CAM_CHILD but these don't use floats? So I might be totally off there.

    Technically I could do the script without getting this data, but it would be a ton of trial and error to number guess on 200 seperate locations, I would probably give up on setting the pitch properly at that point.
    Reply With Quote  

  2. #2  
    Three-Socks's Avatar
    Three-Socks is online now Developer
    Join Date
    Feb 2011
    Posts
    362
    Downloads
    16
    Uploads
    0
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    83
    Likes Received
    308
    I'm not sure how to get the actual cam pitch. But this will give you the xyz positioning of the current cam - Which might get you want you want, im not sure.

    Code:
    /**
     * This file is from https://bitbucket.org/ThreeSocks/gtaiv-example-mods/
     *
     * By Three-Socks
     *
     */
    
    #include <natives.h>
    #include <common.h>
    #include <strings.h>
    #include <types.h>
    #include <consts.h>
    
    #include "Functions.c"
    
    float game_cam_x, game_cam_y, game_cam_z, pos_x = 0.0500, width = 0.3000, height = 0.3000;
    uint r = 255, g = 255, b = 255, a = 110;
    Camera game_cam;
    
    void DoLoop(void)
    {
    	GET_GAME_CAM(&game_cam);
    	if (IS_CAM_ACTIVE(game_cam))
    	{
    		GET_CAM_POS(game_cam, &game_cam_x, &game_cam_y, &game_cam_z);
    		set_up_draw(2, width, height, r, g, b, a);
    		draw_float("NUMBR", pos_x, 0.1000, game_cam_x);
    		set_up_draw(2, width, height, r, g, b, a);
    		draw_float("NUMBR", pos_x, 0.1300, game_cam_y);
    		set_up_draw(2, width, height, r, g, b, a);
    		draw_float("NUMBR", pos_x, 0.1600, game_cam_z);
    	}
    }
    
    void main(void)
    {
    	while(true)
    	{
    		WAIT(0);
    		DoLoop();
    	}
    }
    I hope it helps and good luck with your project
    jumper and nativesith like this.
    Reply With Quote  

  3. #3  
    jumper's Avatar
    jumper is offline Developer
    Join Date
    Jul 2005
    Posts
    289
    Downloads
    3
    Uploads
    0
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    74
    Likes Received
    207
    Thanks for the quick reply (and everything else!). That isn't exactly what I needed but helpful nonetheless, I mixed it in with your xyzh_coords and viola!



    I'm going to switch GAME_CAM_POS to GET_CAM_ROT and see what pops out, I'm not sure how there can be 3 different rotation angles, but I shall print them to screen and see, maybe one will be that magic info I seek.

    EDIT I believe I have found what I need! GET_CAM_ROT definitely gives me the angles.



    If anyone is interested this is the code
    Code:
    /**
     * This file is from https://bitbucket.org/ThreeSocks/gtaiv-example-mods/
     *
     * By Three-Socks
     *
     */
    
    #include <natives.h>
    #include <common.h>
    #include <strings.h>
    #include <types.h>
    #include <consts.h>
    
    #include "Functions.c"
    
    float x, y, z, h, game_cam_x, game_cam_y, game_cam_z, pos_x = 0.05000000, width = 0.30000000, height = 0.30000000;
    uint r = 255, g = 255, b = 255, a = 210;
    Camera game_cam;
    
    void DoLoop(void)
    {
    	GET_CHAR_COORDINATES(GetPlayerPed(), &x, &y, &z);
    	GET_CHAR_HEADING(GetPlayerPed(), &h);
    	GET_GAME_CAM(&game_cam);
    	if (IS_CAM_ACTIVE(game_cam))
    	{
    		GET_CAM_ROT(game_cam, &game_cam_x, &game_cam_y, &game_cam_z);
    		set_up_draw(2, width, height, r, g, b, a);
    		draw_float("NUMBR", pos_x, 0.10000000, x);
    		set_up_draw(2, width, height, r, g, b, a);
    		draw_float("NUMBR", pos_x, 0.13000000, y);
    		set_up_draw(2, width, height, r, g, b, a);
    		draw_float("NUMBR", pos_x, 0.16000000, z);
    		set_up_draw(2, width, height, r, g, b, a);
    		draw_float("NUMBR", pos_x, 0.19000000, h);
    		set_up_draw(2, width, height, r, g, b, a);
    		draw_float("NUMBR", pos_x, 0.25000000, game_cam_x);
    		set_up_draw(2, width, height, r, g, b, a);
    		draw_float("NUMBR", pos_x, 0.28000000, game_cam_y);
    		set_up_draw(2, width, height, r, g, b, a);
    		draw_float("NUMBR", pos_x, 0.31000000, game_cam_z);
    	}
    }
    
    void main(void)
    {
    	while(true)
    	{
    		WAIT(0);
    		DoLoop();
    	}
    }
    Last edited by jumper; 06-26-2012 at 03:14 AM.
    nativesith and spadger like this.
    Reply With Quote  

  4. #4  
    spadger's Avatar
    spadger is offline Member
    Join Date
    Mar 2012
    Location
    UK
    Posts
    143
    Downloads
    2
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    29
    Likes Received
    29
    Gives some interesting thoughts, thanks
    Reply With Quote  

  5. #5  
    JDMAlex's Avatar
    JDMAlex is offline & developer
    Join Date
    Nov 2010
    Posts
    723
    Downloads
    5
    Uploads
    1
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    190
    Likes Received
    442
    try SET_CAM_ATTACH_OFFSET ? used it in my construction mod..
    Reply With Quote  

  6. #6  
    jumper's Avatar
    jumper is offline Developer
    Join Date
    Jul 2005
    Posts
    289
    Downloads
    3
    Uploads
    0
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    74
    Likes Received
    207
    I may have gotten a bit ahead of myself. My end goal was to have a seperate script force the camera to a specific heading and pitch while holding L2 to aim a gun, essentially auto-aiming at a specific static angle, but I can't seem to make that happen just yet. I am trying to do that along with a teleport, so I might be screwing something up there with the combination of the two. I guess the smart thing is to try to get the aim thing working on it's own script, then integrate it with the teleport if I get it working.

    What I was originally after on this thread is done I believe, I have all of the angle data recorded on video thanks to the above code, just need to put it to use if possible.

    EDIT here's a preview clip of what I got so far. All 200 locations work, but a few of the coordinates need tweaking, I need to finish all the fancy on screen stuff, and I have yet to mess with the camera angle "auto-aim" idea.
    Last edited by jumper; 06-27-2012 at 02:11 AM.
    Reply With Quote  

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •