Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

[SA] Camera coding


EvilRaptor
 Share

Recommended Posts

Is there any way for me to get a camera to move around, whilst locking on to a certain object, e.g. a vehicle/actor?

 

As far as I can tell, the only opcode I might be able to use would be

0679: put_camera_on_car [email protected] with_offset 0.0 -2.0 $Z_CAMERA rotation 0.0 0.0 [email protected] 0.0 2

 

 

but I'm under the assumption that rotation would be the camera angle, i.e. where it's pointing.

 

Edit: excuse the handles, I got the line from the opcodes search in Sanny lol

Edited by EvilRaptor
Link to comment
Share on other sites

Michael_J_Scofield
Is there any way for me to get a camera to move around, whilst locking on to a certain object, e.g. a vehicle/actor?

 

As far as I can tell, the only opcode I might be able to use would be

0679: put_camera_on_car [email protected] with_offset 0.0 -2.0 $Z_CAMERA rotation 0.0 0.0 [email protected] 0.0 2

 

 

but I'm under the assumption that rotation would be the camera angle, i.e. where it's pointing.

 

Edit: excuse the handles, I got the line from the opcodes search in Sanny lol

I think you can use Camhack for it, or San An Studios, i would prefer Camhack smile.gif

Link to comment
Share on other sites

Nyuh, it's not like, for a "hmm, I'm gonna have a look around" moment, alas, if only it were that easy...

It's for a script, like, I want the camera to lock onto a car that spawns, and rotate around the car, sorta like, if you move the mouse around while in a car... 'cept the camera's locked onto a different car... the player's on foot, and the script spawns the car infront of the player, and I want the camera to circle the car...

Link to comment
Share on other sites

 

Nyuh, it's not like, for a "hmm, I'm gonna have a look around" moment, alas, if only it were that easy...

It's for a script, like, I want the camera to lock onto a car that spawns, and rotate around the car, sorta like, if you move the mouse around while in a car... 'cept the camera's locked onto a different car... the player's on foot, and the script spawns the car infront of the player, and I want the camera to circle the car...

There exist several opcodes for camera settings.

Every kind makes impossible to move the cam with mouse like with default camera behavior

but you can use mouse input opcode to calculate camera settings

 

 

put the camera on vehicle

 

00A5: [email protected] = create_car #INFERNUS at 2487.5  -1660.5  13.350679: put_camera_on_car [email protected] with_offset 0.0 -5.0 1.5 rotation 0.0 0.0 0.0 0.0 2//view trunk0679: put_camera_on_car [email protected] with_offset 0.0 -5.0 1.5 <--xyz position relativ to carxyz point to view relativ to car-->> 0.0 0.0 0.0 rotation -->> 0.0 2 <--mode

 

 

the equivalent for the actor is opcode 067C:

 

067C: $PLAYER_ACTOR  0.0  3.0 0.7  0.0  0.5 0.5 0.0  2

 

If you put the cam to player the player-walk-movement will be buggy

 

In connection with opcode 015F: you can set the camera view to follow an actor automaticly

 

015F: set_camera_position -2248.2187 -79.441 37.7686 rotation 0.0 0.0 0.00159: camera_on_ped [email protected] 15 2

 

 

very useful:

put camera with_offset on vehicle and cam follows autom. an actor

 

067B: put_camera_on_car [email protected] with_offset -7.5 15.5 7.5 point_to_actor [email protected] tilt 6.0 2

 

 

the standart camera opcodes can also be used to do a lot of things

 

 

015F: set_camera_position -2257.533 -56.77364 54.17 rotation 0.0 0.0 0.0 0160: set_camera_point_at -2250.72 -77.55 35.1 mode 2

 

 

depending to your scripting skills to do cuning calculations for variable camera parameter

 

 

0407: create_coordinate [email protected] [email protected] [email protected] from_car [email protected] with_offset 0.0 0.0 1.5015F: set_camera_position [email protected] [email protected] [email protected] rotation 0.0 0.0 0.0

 

 

Exemple:

The script below let the camera turn around the player and move up-down in a sine curve

 

{$CLEO .cs}:KurveCam_B_103A4: name_thread 'FCAM':KurveCam_B_20001: wait  0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false @KurveCam_B_200D6: if  00AB0:   key_pressed 8//////////<<<<<<-------------Backspace004D: jump_if_false @KurveCam_B_20007: [email protected] =  0.0  // floating-point values  0007: [email protected] =  0.5  // floating-point values  0002: jump @KurveCam_B_11:KurveCam_B_30001: wait 0 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false @KurveCam_B_3 00D6: if  080E1:   NOT   key_pressed  0  15//////<<<<<<-----------Enter/Exit-Taste--to cancel cam drive004D: jump_if_false @KurveCam_B_25000B: [email protected] +=  2.5  // floating-point values:KurveCam_B_110007: [email protected] =  9.0  // floating-point values//<<<<<<-----input for radius of camera drive/set_camera_position 02F6: [email protected] = cosine [email protected]  // sinus swapped with cosine02F7: [email protected] = sinus [email protected] // cosine swapped with sinus 006B: [email protected] *= [email protected]  // floating-point values006B: [email protected] *= [email protected]  // floating-point values0007: [email protected] =  3.5  // floating-point values//<<<<<<-----input for radius of up-down-curve/set_camera_position 02F7: [email protected] = sinus [email protected] // cosine swapped with sinus 006B: [email protected] *= [email protected]  // floating-point values000B: [email protected] +=  2.5  // floating-point values0007: [email protected] =  1.5  // floating-point values//<<<<<<-----input for radius of camera target/point_camera 02F6: [email protected] = cosine [email protected]  // sinus swapped with cosine02F7: [email protected] = sinus [email protected] // cosine swapped with sinus 006B: [email protected] *= [email protected]  // floating-point values006B: [email protected] *= [email protected]  // floating-point values:KurveCam_B_1304C4: create_coordinate [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR offset [email protected] [email protected] [email protected] 04C4: create_coordinate [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR offset [email protected] [email protected] [email protected]: set_camera_position [email protected] [email protected] [email protected]  0.0  0.0  0.00160: point_camera [email protected] [email protected] [email protected]  20002: jump @KurveCam_B_3:KurveCam_B_250001: wait  250 ms0373: set_camera_directly_behind_player02EB: restore_camera_with_jumpcut0002: jump @KurveCam_B_2

 

 

 

 

 

Carrec paths for driving vehicles are useful to make ingame vids

what is carrec path? read here

how to set camera to vehicle which drive on carrec path? read here

Link to comment
Share on other sites

Mmm... I believe he wants the camera to circle automatically?

 

 

0007: [email protected] = 0.0 // Starting rotation.:LOOPwait 0if   0449:   actor $PLAYER_ACTOR in_a_carelse_jump @LOOP01B4: set_player $PLAYER_CHAR can_move 003C0: [email protected] = actor $PLAYER_ACTOR car000B: [email protected] += 3.0 // Movement multiplier. Increase for more camera speed. Decrease for less speed.02F7: [email protected] = sine [email protected]: [email protected] = cosine [email protected]: [email protected] *= 10.0 // Increase to make the X Pos of the camera further away from the car.0013: [email protected] *= 10.0 // Increase to make the Y Pos of the camera further away from the car.0679: put_camera_on_car [email protected] with_offset [email protected] [email protected] 2.0 rotation 0.0 0.0 0.0 0.0 2jump @LOOP

 

 

 

Convenient time to ask this question as I was just working on a sine/cosine tutorial for something like this but didn't really know a simple way to demonstrate it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.