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

3rd Person Camera Help needed

Status
Not open for further replies.
Level 10
Joined
May 21, 2006
Messages
323
I have implemented a 3rd person Cam view into my map, a problem I had to deal with was that
the Z offset of the cam didnt moved with the unit, when the cammed unit moved to a higher or lower stage.

I tried to solve the problem through trigger it with Z of Cammed unit

Every 0.20 sek

If Z of Cammed Unit Greater than or equal to 0
and Less than 200

Set Z offset of Cam to Z of Point of Unit

The Problem is there that the Z of the cam is not the same Z as the Cammedunit

So i had to make more triggers

If Z of Cammed Unit Greater than or equal to 200
and Less than 300

Set Z offset of Cam to Z of Point of Unit - 100

...

If Z of Cammed Unit Greater than or equal to 1000
and Less than 1200

Set Z offset of Cam to Z of Point of Unit - 600



So my question is, if anyone knows an algorithm to calculate the perfect cam Height.

would be helpful
 
Level 17
Joined
Jul 17, 2011
Messages
1,864
not all of it, you need a jass function to get the Z height which does not exist in gui rest can be done with gui variables:

all u need is 3 real variables, 2 for location (X and Y) and 1 for the z height and 1 location variable;

[trigger=trigger]
Untitled Trigger 020000000000000000
Events
Conditions
Actions
Set TempX = (X of (Center of (Playable map area)))
Set TempY = (X of (Center of (Playable map area)))
Set points = ((Center of (Playable map area)) offset by (TempX, TempY))
Custom script: set udg_r = GetLocationZ(points)
[/trigger]

you can use either the xy coordinates or unit location whatever works
 
Level 17
Joined
Jul 17, 2011
Messages
1,864
Status
Not open for further replies.
Top