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

Camera height above Doodads or Destructibles

Status
Not open for further replies.
Level 25
Joined
Feb 2, 2006
Messages
1,689
Hey,
I think it is quite a noob question but I cannot remember how you can achieve that the camera height is bigger over doodads or destructibles which have a certain height themselves but are not placed on a higher cliff level.

Imagine a bridge placed over water at a certain height. The cliff level is still 0 or even below since the water is under the bridge but the bridge itself is very high. I want the camera to zoom out like it does automatically on cliffs.

Is it SetDestructableOccluderHeight() which is used for the elevators or can I a set it in the object editor?
 
OccluderHeight has a different purpose: it sets the fog of war blocking height of the destructable.

If you want the camera to follow the height of a destructable, you need to manually change the camera z-offset at these places.


I'd say just run a periodic timer that periodically enumerates all destructables at the camera target position, hides/unhides them and then compares GetLocationZ() at the camera target position with and without destructables hidden.
If it's the same, set the z-offset to 0.
If it's different, set the z-offset to the height difference.


As you might want to have some smooth interpolation going on, I'd recommend actually grid-testing your entire map at map init and storing the offset values in a table. This way you can use polynomials to make your camera go up smoothly the closer you come to a bridge.
This is very similar to how the natural camera height is done in WC3.


I also highly recommend to use z-offset, not actual camera distance for the height adjustment, as z-offset is the only value that can not be changed via the mouse-wheel.
 
hm sounds much more complicated than I thought. Is there an existing system for this?
No, but the grid testing has been done before in this lib:
GetCamOffset


Could I also just add some rects where I want to have a certain height and somehow smoothly apply the camera field over time?
Yes. Basicly all you need to do then is making the rect sufficiently big and test periodically if the camera target is within the rect.
If it is, adjust the z-offset by the distance to the rect center (as you don't want it to suddenly jump up).
 
Sorry to reopen this but I tried GetCamOffset() add specific locations and it always returns 0. Shouldn't it return the camera height which is assigned by Warcraft III?

I just added the library to my code. The call is done AFTER the map initialization when some time has already passed.
It only returns the offset between the camera interpolation result and the should-be camera height. It does not return the camera height itself.

Basicly, it returns the value that you have to enter for CAMERA_FIELD_Z_OFFSET to prevent the camera interpolation.
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
I encountered the same problem in one of my maps and solved it by using dummy destructables. I used a custom camera anyway in this map, and so I checked for these destructables being in range of a dummy rect around the hero. If this was true, the camere would change to another camera setting (zoom out).
For performance reasons, I only gave this possibility in certain regions of the map.
 
How do I get the camera interpolation value then? If I get the value 0 I can't do anything.
The system doesn't account for destructables. It only considers cliffs and natural height modifiers. Which is probably because the camera doesn't care for destructables either...
 
Status
Not open for further replies.
Top