• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Camera Problem

Status
Not open for further replies.
Level 16
Joined
Jul 21, 2008
Messages
1,121
I have a question that may be simple to people who tend to use camera functions a lot.

How can I set camera so it doesn't drop when it crosses over lowered terrain?

61545d1248618952-camera-problem-problem.jpg
 

Attachments

  • Problem.JPG
    Problem.JPG
    282.8 KB · Views: 146
I don't think you should try a more efficient way, when you can track this via GetCameraTargetPositionZ function.
You can load this function in the map initialization (or at a point, where this real returns a stable value, which depicts the Z of the ground with no cliffs or ground deformations.
Then, you can run a periodic event, which will track every 0.03 the Z of the ground. Since (I guess) you are using a locked camera on unit, you can find at the point you want the (NormalZ - LowZ), so that, once the Z value of the camera target becomes less than or equal than that (NormalZ - LowZ), the camera's Z will not be applied. In the end, you will have something like
JASS:
if GetCameraTargetPositionZ > (NormalZ - LowZ) then
set LocZ_Camera = (GetLocationZ(<point>))
else
set LocZ_Camera = (NormalZ)
endif
The LowZ is the Z of the ground you don't want the camera to fall.
 
How come? There is also something more you can try, since this pic i can see is based off cliffs and not ground deformations of "Lower" tool, the GetTerrainCliffLevel function. You might want to create a location offset by the target location of the camera (so that it detects the level of the ground before the actual camera target tracks it - and your camera won't fall in the end) and check it, combined with the system you used already (?)
 
Level 4
Joined
Jul 4, 2009
Messages
48
you will only need CameraDistance (real) variable

  • Camera
    • Events
      • Time - Every 0.03 seconds of game time.
    • Conditions
    • Actions
      • Set CameraDistance = Target Z of current camera view
      • Camera - Set Distance to (<number of height what you want> - CameraDistance)
I may be wrong with the trigger names, coz i cant look at the editor atm but if you can figure out what i mean it will work.
i use it too.

Btw if you want you can make it in 2 triggers, so one will set the CameraDistance variable and one will set the ingame camera's distance
You can also make a new variable for the height so you can modify it later.
will correct my post if i can get to the pc where war3 is installed.
 
Status
Not open for further replies.
Top