Collision with the ground?
Blitz3D Forums/Blitz3D Programming/Collision with the ground?
| ||
Hey guys, I'm trying to add some semblance of "gravity" to my little project and I'm having trouble determining how to test when my player entity is touching the ground or not, as opposed to touching a wall or a ramp. Anyone have any suggestions? |
| ||
Check out the code archives, and more particularly the demos that come with B3D. |
| ||
I'm using a license of the B3D SDK and there isn't much in there as far as useful code samples for this particular problem. :( |
| ||
I believe this is a 'common' problem, and I'm not sure if it has been solved properly. Maybe in the archives, as John said ? In a lot of examples, you can climb up a wall as if it was the ground. Maybe you could setup separate collisions ground/walls: player->wall (ie. type 1 <-> type 2) player->ground (ie. type 1 <-> type 3) Then, you could use EntityCollided(player, 2). That would check if the object 'player' has collided with an object with a certain collision type, in this case type 2. EntityType player, 1 EntityType ground, 2 EntityType walls, 3 Collisions 1, 2, 2, 3 Collisions 1, 3, 2, 3 repeat if EntityCollided(player, 2) then ...player has collided with floor end if forever |
| ||
Check the collisionny() and if it's > ( say .75 ) you know you're on a relatively flat surface, 1.0 being completely flat. Stevie |
| ||
Hey guys, Thanks for the quick replies :) I have some stuff to try now, heheh. Cheers! |