• 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.

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,863
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,863
Status
Not open for further replies.
Top