• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

Adjusting 3rd pers Cam with ZLocation

Status
Not open for further replies.
Level 10
Joined
May 21, 2006
Messages
323
I need when adjusting the third person camera in my project so it fits in the different terrain heights. I use ZLocation to get the Z of my unit but now I need a formular to also fit the camera height, because the higher the unit stands the way higher the camera goes and this sucks ;D

Edit: The Camera systems in the spell section are all not really good in my opinion.
 
What you are looking for, is this:

http://www.hiveworkshop.com/forums/graveyard-418/getcamoffset-131434/

This is a neat little script that combats the camera terrain interpolation that is the main cause for the camera rising too high or sinking into the ground. The GetCamOffset function basicly returns the value that is needed to have the camera always at constant height above ground.

Apply the offset and it should work. However, you'd still want to adjust the Angle of Attack if your unit is walking up or down a hill.

call SetCameraField(CAMERA_FIELD_ZOFFSET, z-GetCamOffset(x,y))
 
Level 10
Joined
May 21, 2006
Messages
323
The Angle of Attack adjustment is not a problem. Btw I wrote you a visitor message some weeks ago, I would be glad if you could help me there, too. But anyway Great thanks I will try that! ;D

Edit: Do I have to type in the variables for z, x and y in this line. I am pretty new in Jass ;D
 
The Angle of Attack adjustment is not a problem. Btw I wrote you a visitor message some weeks ago, I would be glad if you could help me there, too. But anyway Great thanks I will try that! ;D

Edit: Do I have to type in the variables for z, x and y in this line. I am pretty new in Jass ;D
If you want to use this in Gui via custom script, just create 3 gui variables called X,Y,Z and replace x,y and z in the script line by udg_X, udg_Y, udg_Z.
 
Level 10
Joined
May 21, 2006
Messages
323
Thank you, that's easier. Do I have to set Z to ZLocation and x and y to the x and y of the targeted unit/point?
  • Camera
    • Ereignisse
      • Zeit - Every 0.03 seconds of game time
    • Bedingungen
      • GlobalCameraOn[1] Gleich (==) False
      • ScriptisRunning Gleich (==) False
    • Aktionen
      • Set TempInteg = HeroNumber
      • Set TempPlayer = Spieler 1 (Rot)
      • Kamera - Lock camera target for TempPlayer to Hero[TempInteg], offset by (0.00, 0.00) using Die Drehung der Einheit
      • Set TempReal = Opt_Real[2]
      • Kamera - Set TempPlayer's camera Entfernung zum Ziel to TempReal over 0.00 seconds
      • Set TempReal = Opt_Real[3]
      • Kamera - Set TempPlayer's camera Sichtfeld to TempReal over 0.00 seconds
      • Set TempReal = Opt_Real[4]
      • Kamera - Set TempPlayer's camera Fernes Z to TempReal over 0.00 seconds
      • Set Y = (Y of Hero[TempInteg])
      • Set X = (X of Hero[TempInteg])
      • Set TempPoint = (Position of Hero[TempInteg])
      • Custom script: set udg_TempReal2 = GetLocationZ(udg_TempPoint)
      • Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, udg_TempReal2-GetCamOffset(udg_X, udg_Y))
      • Set TempReal = (Facing of Hero[TempInteg])
      • Set TempPoint2 = (TempPoint offset by 200.00 towards TempReal degrees)
      • Kamera - Set TempPlayer's camera Drehung to TempReal over 0.00 seconds
      • Custom script: set udg_TempReal = GetLocationZ(udg_TempPoint2)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • 'IF'-Bedingungen
            • TempReal Größer als (>) TempReal2
          • 'THEN'-Aktionen
            • Set TempReal = ((TempReal x 0.10) / TempReal2)
            • Set TempReal = (TempReal + 0.90)
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Bedingungen
                  • TempReal Kleiner als (<) 1.00
                • 'THEN'-Aktionen
                  • Set TempReal = 1.00
                • 'ELSE'-Aktionen
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Bedingungen
                  • TempReal Größer gleich (>=) 1.10
                • 'THEN'-Aktionen
                  • Set TempReal = 1.10
                • 'ELSE'-Aktionen
            • Set TempReal3 = (Opt_Real[1] x TempReal)
            • Set TempReal3 = (Opt_Real[1] x TempReal)
          • 'ELSE'-Aktionen
            • Set TempReal3 = Opt_Real[1]
      • Kamera - Set TempPlayer's camera Perspektive to TempReal3 over 0.00 seconds
      • Set TempReal = 0.00
      • Set TempInteg = 0
      • Point - Remove TempPoint
      • Point - Remove TempPoint2
This Trigger is a little bit messed up now because of several try outs but is this how it could work? Because the map doesnt even start with the new function ;D Jass is an invention of the devil!
 
Can't find anything in this trigger that should stop the map from running. Did you actually import the script I linked? The custom script obviously would only work with the system imported. ;)

Does TempReal2 exist in the variable editor?

Did you use Newgen WE? The script doesn't work with the default map editor as it defines a custom library.
 
Level 10
Joined
May 21, 2006
Messages
323
Yeah I am still using 5d version, but I heard that there is a 5e version, but my map is too complex now that I could open it with the newer version. Jasshelper is enabled, is there a way to just update the JASShelper?
 
Status
Not open for further replies.
Top