• 🏆 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!

Third person camera Z postition problem

Status
Not open for further replies.
Level 5
Joined
Jul 14, 2014
Messages
115
This is my trigga trigger for the camera:


  • Events
    • Time - Every 0.05 seconds of game time
  • Conditions
  • Actions
    • Set Mov_Location[2] = (Position of Hero)
    • Custom script: set udg_Mov_Height=GetLocationZ(udg_Mov_Location[2])
    • Camera - Set Player 1 (Red)'s camera Angle of attack to 345.00 over 0.10 seconds
    • Camera - Set Player 1 (Red)'s camera Height Offset to (Mov_Height - 100.00) over 0.10 seconds
    • Camera - Set Player 1 (Red)'s camera Distance to target to 600.00 over 0.10 seconds
    • Camera - Set Player 1 (Red)'s camera Rotation to Mov_Angle over 0.10 seconds
    • Custom script: call RemoveLocation(udg_Mov_Location[2])


And this happens when going higher. It simply looks ugly



Pls help :goblin_jawdrop:
 
Level 10
Joined
Apr 4, 2010
Messages
509
Check this map out. It's an arrow key walk system just like yours, but it has no camera issues when going up high terrain. I used it before.

EDIT: Try doing this,
  • Camera - Lock camera target for (Owner_Of_Hero) to (Hero), offset by (0.00, 0.00) using The unit's rotation
Also what is the Mov_Angle?
  • Camera - Set Player 1 (Red)'s camera Rotation to Mov_Angle over 0.10 seconds
EDIT: I found how to fix it, do this:
  • Camera - Set Player 1 (Red)'s camera Distance to target to (Mov_Height + 400.00) over 0.10 seconds
http://www.epicwar.com/maps/132538/
 
Last edited:
Level 5
Joined
Jul 14, 2014
Messages
115
Check this map out. It's an arrow key walk system just like yours, but it has no camera issues when going up high terrain. I used it before.

EDIT: Try doing this,
  • Camera - Lock camera target for (Owner_Of_Hero) to (Hero), offset by (0.00, 0.00) using The unit's rotation
Also what is the Mov_Angle?
  • Camera - Set Player 1 (Red)'s camera Rotation to Mov_Angle over 0.10 seconds
EDIT: I found how to fix it, do this:
  • Camera - Set Player 1 (Red)'s camera Distance to target to (Mov_Height + 400.00) over 0.10 seconds

I did the:

  • Camera - Lock camera target for (Owner_Of_Hero) to (Hero), offset by (0.00, 0.00) using The unit's rotation
just in another trigger I forgot to show.

Mov_Angle is used to rotate around the hero.

If I do (Mov_Height + 400.0) then The camera will be so high up that I won't be able to see my own hero. Srry

EDIT: I got the arrow key movement system from the map you're showing me :p

EDITEDIT: Just took a look at that map again and found that is has the same problem :p


Srry I don't use JASS
 
Last edited:
Srry I don't use JASS
*Sigh*... it's just a single function to call. Nothing to be scared of. Just create a real variable called "Z_Offset" and use this after copy and pasting the system I linked into your map:

  • Custom Script: set udg_Z_Offset = GetCamOffset(GetCameraTargetPositionX(), GetCameraTargetPositionY())
Just do this periodically and always adjust the Z-offset of the camera by the returned value. It will take care of the default camera height interpolation.
 
Level 5
Joined
Jul 14, 2014
Messages
115
*Sigh*... it's just a single function to call. Nothing to be scared of. Just create a real variable called "Z_Offset" and use this after copy and pasting the system I linked into your map:

  • Custom Script: set udg_Z_Offset = GetCamOffset(GetCameraTargetPositionX(), GetCameraTargetPositionY())
Just do this periodically and always adjust the Z-offset of the camera by the returned value. It will take care of the default camera height interpolation.

But what's the difference between GetCamOffset and getLocation then?

The (Mov_Height + 400) is the
  • distance to target
, not the camera Height.
That just makes the camera go away from the hero as you walk higher, which I don't want. And the problem still persists even with what you suggested
 
But what's the difference between GetCamOffset and getLocation then?
The camera height interpolation doesn't follow the terrain exactly, hence why location Z values do not sufficiently describe it's behaviour. It is smoothed out in order to prevent the camera spiking up or down on every small terrain bump.
The system I linked uses a lot of complicated mathematics to find the offset value needed to effectively get rid of this camera smoothing. As in case of 3D cams, you don't want the height interpolation.

So, in short: the difference between getting a location Z value and GetCamOffset is, that the latter actually solves your problem. ;)
 
Level 5
Joined
Jul 14, 2014
Messages
115
The camera height interpolation doesn't follow the terrain exactly, hence why location Z values do not sufficiently describe it's behaviour. It is smoothed out in order to prevent the camera spiking up or down on every small terrain bump.
The system I linked uses a lot of complicated mathematics to find the offset value needed to effectively get rid of this camera smoothing. As in case of 3D cams, you don't want the height interpolation.

So, in short: the difference between getting a location Z value and GetCamOffset is, that the latter actually solves your problem. ;)

But as stated above: doesn't that require vJass?
 
But as stated above: doesn't that require vJass?
It requires Newgen/Jasshelper, yes. But it doesn't require knowledge of vJass to use.

Also, it is very easy to convert this into normal JASS aswell. If you need this, just ask. Actually, you could do that alone; just remove the library and initializer things and rename the initialization function to "InitTrig_cameramap"
 
Level 5
Joined
Jul 14, 2014
Messages
115
It requires Newgen/Jasshelper, yes. But it doesn't require knowledge of vJass to use.

Also, it is very easy to convert this into normal JASS aswell. If you need this, just ask. Actually, you could do that alone; just remove the library and initializer things and rename the initialization function to "InitTrig_cameramap"
Isn't their like and easier way to do that?
without any code?
 
Isn't their like and easier way to do that?
without any code?
Unfortunately, if you want this to look good, there is no way around this resource. Because that's what it was made for.

What exactly is your problem with it? Just drop it in your map and use the custom script I demonstrated above. It will work.
 
It's all complicated and might mess up my map :grin:
It's not and it doesn't.

*Sigh* ... look; I've been doing this for years. I'm not suggesting this to mess with people. It's the only way to fix this problem elegantly and effectively. Just... drop it into your map and use the custom script. It will be fine. Trust me.
 
Level 17
Joined
Dec 11, 2014
Messages
2,004
It's not and it doesn't.

*Sigh* ... look; I've been doing this for years. I'm not suggesting this to mess with people. It's the only way to fix this problem elegantly and effectively. Just... drop it into your map and use the custom script. It will be fine. Trust me.

You sound like 1200 years old people talking to a 1 month boy.

Neverthless, he is right. Systems don't get approved out of nowhere.
 
Last edited:
Status
Not open for further replies.
Top