- Joined
- May 19, 2010
- Messages
- 34
Hey guys,
So I've been trying to make a good first person camera for a few days and I'm having trouble.
Basically I can make the camera follow the unit when walking around on flat ground and it follows the unit when walking up HILLS (i.e. terrain that has had "Apply Height" performed on it). But when I go up CLIFFS to a higher cliff level it starts getting more and more offset.
EDIT : I just checked the numbers again for hills and they don't work exactly right either (although they aren't as bad as the cliffs)
For example, I have a map with original cliff level 0 and I attach my camera to the unit so that it's at the right height, as if looking out the unit's eyes. When I walk up one cliff level, the unit's Z position goes from -256 to -128, an increase of 128. So I would expect the camera's Z offset to increase by 128 as well. However, when I check the camera's Z source it increases by around 190 .
By the time I've gone up 3-4 cliff levels the camera is a few hundred units too high .
I've been researching it for ages and it seems like you have to adjust the way you change the camera's Z offset depending on what cliff level you're standing on, but I just can't seem to figure out how.
Here's the system I use, I've seen it in alot of threads :
I'll attach the map too (ignore the primitive movement system). I constantly print out the unit height and the camera Z height in chat, which is when I noticed that they were changing differently.
Any help would be appreciated, thanks!
So I've been trying to make a good first person camera for a few days and I'm having trouble.
Basically I can make the camera follow the unit when walking around on flat ground and it follows the unit when walking up HILLS (i.e. terrain that has had "Apply Height" performed on it). But when I go up CLIFFS to a higher cliff level it starts getting more and more offset.
EDIT : I just checked the numbers again for hills and they don't work exactly right either (although they aren't as bad as the cliffs)
For example, I have a map with original cliff level 0 and I attach my camera to the unit so that it's at the right height, as if looking out the unit's eyes. When I walk up one cliff level, the unit's Z position goes from -256 to -128, an increase of 128. So I would expect the camera's Z offset to increase by 128 as well. However, when I check the camera's Z source it increases by around 190 .
By the time I've gone up 3-4 cliff levels the camera is a few hundred units too high .
I've been researching it for ages and it seems like you have to adjust the way you change the camera's Z offset depending on what cliff level you're standing on, but I just can't seem to figure out how.
Here's the system I use, I've seen it in alot of threads :
- Set CameraZ = (Position of Camera 0001 <gen>)
- Custom script: set udg_UnitZ = GetLocationZ(udg_CameraZ)
- Camera - Set Player 1 (Red)'s camera Height Offset to (UnitZ + 300.00) over 0.00 seconds
- Custom script: call RemoveLocation(udg_CameraZ)
I'll attach the map too (ignore the primitive movement system). I constantly print out the unit height and the camera Z height in chat, which is when I noticed that they were changing differently.
Any help would be appreciated, thanks!
Attachments
Last edited: