• 🏆 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 follow terrain

Status
Not open for further replies.
Level 21
Joined
Aug 21, 2005
Messages
3,699
I've been thinking of this, and you actually might be able to do this.

What normally happens is that the camera checks the camera target height, and then increases / decreases its height accordingly. Which means your camera eye height might potentially be lower than the height of the hill at the eye. To fix it, you'd need to check the height of the eye and the height of the hill at the eye position. Then increase / decrease the height accordingly.
 
Level 5
Joined
Dec 29, 2008
Messages
61
Download Warcraft III Spells - Camera System
Then replace the "Pan camera" action with "Pan camera with height offset"

Damn! I wish this map still existing. I'm currently trying to implement the same thing in my RPG.

This gives me my "hero" cam.

Note: Set mPlayer[PlayerCount] above just refers an array of characters because it's a multiplayer game. You can just use Player 1 (Red) or whatever.

  • Events
    • Time - Every 0.03 seconds of game time
  • Actions
    • Camera - Lock camera target for mPlayer[PlayerCount] to mHero[PlayerCount], offset by (0.00, 0.00) using Default rotation
    • Camera - Set mPlayer[PlayerCount]'s camera Rotation to (Facing of mHero[PlayerCount]) over 0.00 seconds
    • Camera - Set mPlayer[PlayerCount]'s camera Distance to target to 300.00 over 0.00 seconds
    • Camera - Set mPlayer[PlayerCount]'s camera Angle of attack to 330.00 over 0.00 seconds
    • Camera - Set mPlayer[PlayerCount]'s camera Height Offset to 80.00 over 0.00 seconds
    • Camera - Set mPlayer[PlayerCount]'s camera Far Z to 5000.00 over 0.00 seconds
    • Camera - Set mPlayer[PlayerCount]'s camera Field of view to 1000.00 over 0.00 seconds
I wonder if you can calculate the current hero height and subtract the minimum terrain height and then pan the camera's height offset by that amount.

EDIT:

So I have a very rudimentary solution. It's not elegant by any means and I'm unsure if there will be any memory leaks. I created a "Height Dummy" character. I based it off the Shade and gave it permanent invisibility, invulnerability (neutral), and made it so it can't attack. That should keep the unit out of sight and out of mind.

Then I swapped the height offset function above with this:

  • Camera - Set mPlayer[PlayerCount]'s camera Height Offset to (((Position - Z of mHero[PlayerCount]) + 80.00) - (Position - Z of Aiden Hait 0108 <gen>)) over 0.00 seconds
Since this dummy (yes, Aiden Hait is a pun) is placed at the lowest point of the map it should always offset your camera in the Z direction by the difference between you and the dummy.

EDIT 2: Unfortunately, this doesn't work very well at higher heights because it doesn't update the Angle of Attack.
 
Last edited:
Status
Not open for further replies.
Top