Chase Camera strategies

Blitz3D Forums/Blitz3D Beginners Area/Chase Camera strategies

Dare2(Posted 2005) [#1]
Messing around with the castle demo, I get situations where the camera is "behind" something. Eg, the ground. The avatar now appears to be standing in thin air.

I was wondering what strategies you guys used in these situations. Move the camera forward until it hard up against the avatar? Try to find the best available angle?

What is a good, or even best, strategy here?


WolRon(Posted 2005) [#2]
I don't know the best, but you could perform a line pick between the camera and the player and if it returns anything but the player, then move it (say) half the distance towards the player and try again.

Or, if the linepick returned anything but the player, you could move the camera (with Collisions off) to the players position (not changing it's rotation), then move it backwards (with Collisions on) back where it was. It will stop at the nearest obstacle.

Like you suggested, picking (somewhat) random angles/distances, could be an option as well, but don't get too radical or the player will get disoriented.


Dare2(Posted 2005) [#3]
Hi WolRon,

That's a cool idea. A sort of "binary search" backwards and forwards until there is no obstacle between cam and avatar and so best possible distance is determined quite quickly. Is this what you meant?

Conceptually I think I understand what you mean by "line pick". In coding terms I don't have a clue how to go about this and determining if there is something (or what is) obscuring the target (avatar). Any clues or pointers appreciated.


Edit:

Actually, detecting if the camera collides with the terrain and shortening the distance until it doesn't might be the shot?

So if the avatar zips over the brow of a hill, or is standing on a ledge and turns, the camera zooms in.


WolRon(Posted 2005) [#4]
These functions are built into Blitz. Look at the commands LinePick and Collisions.


Dare2(Posted 2005) [#5]
>> .. built into Blitz.

Hadn't discovered the LinePick function. :) Happiness. And thank you.