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