• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

fixing ingame camera height

Status
Not open for further replies.
Level 5
Joined
Jul 12, 2013
Messages
128
Hi, Is there way to fix a camera height on a certain level ? So the camera won't go lower or higher as the terrain goes. Or is it possible to fix it for some regions ?
 
A simple solution:

  • Set Camera Height
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set TempPoint = (Position of Test Hero 0001 <gen>)
      • Custom script: set udg_rHeroHeight = GetLocationZ (udg_TempPoint)
      • Camera - Set Player 1 (Red)'s camera Height Offset to (rHeroHeight + 200.00) over 0.50 seconds
      • Custom script: call RemoveLocation (udg_TempPoint)
This will set the camera height accordingly to the unit's height. In this case + 200 because it was used for a 3rd person view.
 
Level 5
Joined
Jul 12, 2013
Messages
128
Oh, sorry I explained my problem wrong. I wanted to change the camera height so the camera won't follow terrain. Because I have very steep hills on my map because I wanted to place horizontal doodad on it so it will look like this.
 

Attachments

  • wall3.JPG
    wall3.JPG
    49.3 KB · Views: 295
Last edited:
This is extremely hard to make, as the camera height by wc3 default will be interpolated and smoothed based on the height map.
You need to find out the correct algorithm of the wc3 default camera height interpolation, create a mathematical grid based on the entire height map and then apply the required offset to counter the interpolation.


So basicly, unless you are very experienced with coding in JASS, it's impossible.
 
Level 5
Joined
Jul 12, 2013
Messages
128
I wanted the trigger wich will set camera height for X and the height will be X wherever you're looking at high hill or deep hole in the ground. So in factthe camera won't be following terrain. But your trigger wich you posted here might be useful later on. I already give up that idea. I redesigned my map so the camera won't move down.
 
I wanted the trigger wich will set camera height for X and the height will be X wherever you're looking at high hill or deep hole in the ground. So in factthe camera won't be following terrain. But your trigger wich you posted here might be useful later on. I already give up that idea. I redesigned my map so the camera won't move down.

Alrighty.
Though if you have the camera locked to a unit you can actually pretty easily get the wanted effect by getting the Z location of the camera locked unit and adjust the camera height accordingly.
 
I'm not sure exactly what you mean then. Do you want the camera to stay the same height no matter what?

If you are willing to have a periodic trigger running constantly it can be achieved.
A periodic triggers will only get you to a certain point. Especially since camera data in multiplayer only get updated every 0.1 seconds, the camera will start "shaking" and "bouncing" in multiplayer.

Alrighty.
Though if you have the camera locked to a unit you can actually pretty easily get the wanted effect by getting the Z location of the camera locked unit and adjust the camera height accordingly.
Only works for locked cameras, unfortunately and even then it's not 100% perfect, as the camera height will still get interpolated.
 
This is extremely hard to make, as the camera height by wc3 default will be interpolated and smoothed based on the height map.
You need to find out the correct algorithm of the wc3 default camera height interpolation, create a mathematical grid based on the entire height map and then apply the required offset to counter the interpolation.


So basicly, unless you are very experienced with coding in JASS, it's impossible.

^This. You may want to look into:
http://www.hiveworkshop.com/forums/graveyard-418/getcamoffset-131434/
(check the flight sim too, it is pretty nifty)

Which basically does what Zwieb said. There is a shorter, less accurate method as well:
JASS:
    function SetCameraZ takes real z returns nothing
        // Thanks to Toadcop for this function.
        set z = GetCameraField(CAMERA_FIELD_ZOFFSET)+z-GetCameraTargetPositionZ()
        call SetCameraField(CAMERA_FIELD_ZOFFSET,z,- 0.01)
        call SetCameraField(CAMERA_FIELD_ZOFFSET,z,0.01)
    endfunction
iirc it works decently, but ofc both of these require a bit of JASS knowledge to apply to your map.
 
Damn! I didn't know this baby existed! Why is it graveyarded if it works?

It just needed a description and some privatization. Sadly, Bob never updated it. It is a shame that some great resources end up graveyarded for trivial reasons (or the user becoming inactive). :( But I agree that it needed those changes to be approved.
 
Uuh. That's a very handy code :)
It's kinda sad that it has been graveyarded yeah. But if nazgul is inactive can't a mod just write something up and approve it?

We can, but it would end up being a complete rip of his code (which is unethical). And editing it may be considered unethical as well. I'm sure he wouldn't mind, but we still need permission. After all, the poor guy spent hours measuring the height maps, all through trial and error to get those values. ;P

But anyway, if someone needs it, it'll always be there. I'm just glad he submitted it here--the only other place it was submitted to was to the old wc3jass.com, and that went down.
 
Status
Not open for further replies.
Top