• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to get position of all players cameras

Status
Not open for further replies.
Level 2
Joined
Apr 13, 2014
Messages
15
Hi , i want to save position of every players camera in a variable , pan all the cameras to a place where a cinematic is happening, and after that cinematic i want to pan back all the players cameras to where they was in before . please tell me simplest way you know ,
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Use an integer loop. Then in the integer loop do these.
Store the players camera position. There should be a GUI action for this.
Move players camera to target location.
If wanted Turn on a 0.03 second trigger that has an integer loop to move player cameras to the location. (This is used to keep players from moving their camera.)

After the cinematic is over use the camera variable to move the players cameras back to their original position.
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
Create two real variables in the variable editor called "CamX" and "CamY".

Then use this:
  • Custom script: set udg_CamX = GetCameraTargetPositionX()
  • Custom script: set udg_CamY = GetCameraTargetPositionY()
This will store the camera position to the two variables.

Then, after the cinematic is done, use this to pan back to the original location:
  • Custom script: call PanCameraToTimed(udg_CamX, udg_CamY, 0)
Do NOT use those CamX and CamY values for anything else but panning the camera or else it will desync in multiplayer, as those values will be different for every player.
 
Last edited by a moderator:
Level 2
Joined
Apr 13, 2014
Messages
15
you guys didnt understand , i know how to set variables and how to pan back camera and do all the things i want with that , but i want to know how to find specific players camera , not just game server players camera ,
 
you guys didnt understand , i know how to set variables and how to pan back camera and do all the things i want with that , but i want to know how to find specific players camera , not just game server players camera ,

  • The two functions in Zwieb's post, GetCameraTargetPositionX/Y(), return local values for the player.
    That means that for Player 1 (Red), it will store the variable with Player 1 (Red)'s camera coordinates, for
    Player 2 (Blue) it will store Player 2 (Blue)'s camera coordinates, and so forth.
  • There is no function that will return a particular player's camera coordinates.
  • The only way to receive a particular player's camera coordinates is to sync them, which will take time depending
    on latency. (Usually at least 0.2 seconds) It involves gamecache and JASS, e.g.:
    http://www.hiveworkshop.com/forums/lab-715/observermode-playercameradata-244987/

Anyway, Zwieb's version will work for your purposes. If you need to store other camera properties, just use more variables along with GetCameraField:
  • Custom script: set udg_AngleOfAttack = GetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK)
  • Custom script: set udg_Rotation = GetCameraField(CAMERA_FIELD_ROTATION)
And then you would later set them:
  • Custom script: call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, udg_AngleOfAttack, 0)
  • Custom script: call SetCameraField(CAMERA_FIELD_ROTATION, udg_Rotation, 0)
 
Status
Not open for further replies.
Top