Collisions - Prevent movement in certain direction

Blitz3D Forums/Blitz3D Programming/Collisions - Prevent movement in certain direction

funkmaster5000(Posted 2014) [#1]
Hi all,

I'm using the B3D functions for collisions and they work like a charm! My main problem is that I use a top down view and the camera therfore sticks to the player (GTA style). If my player collides, I can still move the camera. If I try to prevent that via

the camera stops, but the player obviously can't move further, because collided shows 1. How can I handle something like that? Thanks!


Kryzon(Posted 2014) [#2]
I think the trick is having the camera not worrying whether the player is moving or not. It is always focusing on the player, wherever he may be.
The camera is not parented to the player and it does not move with the player speed.

I would do something along these lines:



The order of the calls in the main loop for this would be:

1) PlayerInput()
2) PlayerUpdate()
3) CameraUpdate()


RemiD(Posted 2014) [#3]
I would turn/move the player, calculate the collisions, reposition the player appropriately, then reposition the camera depending on the player position.


fox95871(Posted 2014) [#4]
MeshesIntersect can come in really handy sometimes if things aren't working out with collisions. That's actually what I was working on last night and today. You can make an odd shaped character mesh, or one with separately identifiable parts, all set to move together. And combined with a level mesh that can be just as diverse, all that's left is to setup what happens when what intersects what... including not going in a particular direction at times.


funkmaster5000(Posted 2014) [#5]
Thanks for the hints guys. Unfortunatly I was pretty buisy @ work, so I will try them out ASAP.