Blitz 3D collisions are driving me crazy

Blitz3D Forums/Blitz3D Beginners Area/Blitz 3D collisions are driving me crazy

Cancerian(Posted 2004) [#1]
Hi,

I'm trying to learn the 3D command set and am stuck at collisions. I have a basic understanding of object to object collisions using spheres or squares but the problem occurs when I try to detect collision between an object and a polygonal landscape modeled in a 3D program (not using terrain commands).

As I understand it, since the landscape has hills, cliffs, overhangs, etc. I must use polygonal collision via "entitiesintersect()" but that command doesn't allow for reactions to the collisions: stop, slide, etc.

I understand this would be easier if I used terrains but I need better control over the modeling and texturing of the landscape than the terrain commands offer.

The idea is to build the world in 3D Studio Max and be able to move a character around that world, giving full sliding collision on obstacles. I'm trying to dissect the castle demo at the moment but since the tutorials are written in non-commented spaghetti code >:( it's taking a long time.

Any help or ideas would be appreciated. Thanks!


jhocking(Posted 2004) [#2]
Don't use EntitiesIntersect. Sphere-polygon collisions are setup just like other collisions, by calling Collisions with the right parameters. Make sure to read the documentation of that command in the Command Reference.


Sledge(Posted 2004) [#3]

As I understand it, since the landscape has hills, cliffs, overhangs, etc. I must use polygonal collision via "entitiesintersect()"



Nope - the built-in collision system should be okay I believe.

eg
Entitytype player,1
Entitytype mesh,2
Collisions 1,2,2,3

Don't forget to set Entityradius for the player and Updateworld each frame. The landscape should not move either. Give us some more details if you can't get it going.


Cancerian(Posted 2004) [#4]
Once again, I rushed to post a question when all I had to do was calm down and think things through logically.

I ended up grabbing a coffee, going through the castle demo and commenting the code myself and within 5 minutes I had figured out the problem. I was confusing assigning the collision labels to objects with assigning the types of collision checks (if that makes any sense).

Anyways, I understand it now and am completely blown away with how easy to use and powerful Blitz 3Ds collisions system is! Woo-hoo! Thanks for the replies.

Oh, if anyone has ideas on how to handle things like curbs and stairs that would technically stop sliding collision but the player should be allowed to walk up them I would love to hear them. Thanks again!


jhocking(Posted 2004) [#5]
It's because of stuff like that that I don't use collision detection for placing the player on the ground. Instead, I do a linepick straight down from the player every frame and move the player vertically based on the result of the pick.


Perturbatio(Posted 2004) [#6]
one suggestion I saw elsewhere on this forum for collision with stairs is to use two pivots, an "head" and a "foot" pivot, if the foot pivot collides but not the head then move the player up, if both collide then you've hit an object that is too high to climb.


Sledge(Posted 2004) [#7]

Oh, if anyone has ideas on how to handle things like curbs and stairs that would technically stop sliding collision but the player should be allowed to walk up them I would love to hear them.



You'll find that, with the built-in system, there's a certain amount of latitude dependant on the entity radius, the height of the obstacle and the speed of the collision. Simply put, you can already walk up stairs and small curbs - it's worth testing a few models out to get a feel of how large/small the steps you can get away with are.


WolRon(Posted 2004) [#8]
I've also heard that you can create an invisible ramp in front of the stairs and just have the player collide with the ramp, which will automatically raise him up/down.