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

Getting the right camera height for my cam/movement system

Status
Not open for further replies.
Level 8
Joined
Mar 3, 2009
Messages
327
the movement system is third person (like first person but the camera is back so that you can see the unit that's moving). I can't get the height offset right though.

could someone post the code for accurately detecting how high the camera should be over elevation? thanks.
 
Try >
  • Set Point1 = (Position of (Picked unit))
  • Custom script: set udg_Height = GetLocationZ(udg_Point1) + GetUnitFlyHeight(GetEnumUnit())
  • Camera - Set (Owner of (Picked unit)) Height Offset to (200 + Height) over 0.00 seconds
  • Custom script: call RemoveLocation (udg_Point1)
Height is a real variable.
Point1 is a point variable.
the action for Camera is Camera - Set Camera Field (timed)
 
Level 8
Joined
Mar 3, 2009
Messages
327
thanks, but getlocationZ doesnt cut it. The camera goes higher than the unit, and as far as i know there is no correct formula to multiply it buy to produce the right height (eg, set height = GetLocationZ(udg_temppoint) * 0.8).

I know another function that can be used is GetCameraEyePositionZ, i've seen it used, but im not sure how to use it.
 
Status
Not open for further replies.
Top