I'm trying to implement an RPG hero camera that pans the camera over high terrain. I did a few searches and it looks like everyone has given up.
Here's the camera:
Notes:
This equation sets the camera height offset to the terrain height at the character's position, plus Z units, while also adjusting the camera's angle of attack based on the difference between the terrain height at the character's position and the lowest point on the terrain. This will ensure that the camera view is always constant relative to the character, even as the character moves up and down hills.
Edit: EUREKA! After some fiddling around this works like a charm.
Here's the camera:
-
Update Camera
-
Events
- Time - Every 0.03 seconds of game time
-
Events
-
Actions
- Camera - Lock camera target for mPlayer[PlayerCount] to mHero[PlayerCount], offset by (0.00, 0.00) using Default rotation
- Camera - Set mPlayer[PlayerCount]'s camera Rotation to (Facing of mHero[PlayerCount]) over 0.00 seconds
- Camera - Set mPlayer[PlayerCount]'s camera Distance to target to 300.00 over 0.00 seconds
- Camera - Set mPlayer[PlayerCount]'s camera Angle of attack to (330.00 + ((((Position - Z of mHero[PlayerCount]) - (Position - Z of Aiden Hait 0108 <gen>)) / (Target Z of current camera view)) x 1.00)) over 0.00 seconds
- Camera - Set mPlayer[PlayerCount]'s camera Height Offset to (80.00 - (Abs(((Position - Z of mHero[PlayerCount]) - (Position - Z of Aiden Hait 0108 <gen>))))) over 0.00 seconds
- Camera - Set mPlayer[PlayerCount]'s camera Far Z to 5000.00 over 0.00 seconds
- Camera - Set mPlayer[PlayerCount]'s camera Field of view to 1000.00 over 0.00 seconds
Notes:
- I suspect that (Position - Z of mHero[PlayerCount]) is not the true value of the terrain height at character position.
- Aiden Hait 0108 <gen> is a dummy unit set at the 0 point of the terrain.
- ANGLEDELTA is a constant value that represents the maximum change in angle for a given change in Z offset. You can adjust this value to control the rate at which the camera angle changes as the Z offset changes.
This equation sets the camera height offset to the terrain height at the character's position, plus Z units, while also adjusting the camera's angle of attack based on the difference between the terrain height at the character's position and the lowest point on the terrain. This will ensure that the camera view is always constant relative to the character, even as the character moves up and down hills.
Edit: EUREKA! After some fiddling around this works like a charm.
-
Events
- Time - Every 0.03 seconds of game time
-
Actions
- Camera - Lock camera target for mPlayer[PlayerCount] to mHero[PlayerCount], offset by (0.00, 0.00) using Default rotation
- Camera - Set mPlayer[PlayerCount]'s camera Rotation to (Facing of mHero[PlayerCount]) over 0.00 seconds
- Camera - Set mPlayer[PlayerCount]'s camera Distance to target to 300.00 over 0.00 seconds
- Camera - Set mPlayer[PlayerCount]'s camera Angle of attack to (330.00 + ((((Position - Z of mHero[PlayerCount]) - (Position - Z of Aiden Hait 0108 <gen>)) / (Target Z of current camera view)) x 1.00)) over 0.00 seconds
- Camera - Set mPlayer[PlayerCount]'s camera Height Offset to (((Position - Z of mHero[PlayerCount]) + 200.00) - (Abs(((Position - Z of mHero[PlayerCount]) - (Position - Z of Aiden Hait 0108 <gen>))))) over 0.00 seconds
- Camera - Set mPlayer[PlayerCount]'s camera Far Z to 5000.00 over 0.00 seconds
- Camera - Set mPlayer[PlayerCount]'s camera Field of view to 1000.00 over 0.00 seconds
Attachments
Last edited: