Best collisions system?

Blitz3D Forums/Blitz3D Programming/Best collisions system?

Cubed Inc.(Posted 2012) [#1]
What would be the best method or collision system that you can program in Blitz3d? No DLLs or physics engines (too expensive and unpredictable), just with Blitz3d.


Yasha(Posted 2012) [#2]
too expensive and unpredictable


...? Please be willing to hold an open mind and do some research or you'll never get anywhere. This comment is untrue and, in fact, silly.

ColDet is the best in my experience. It requires you to use a DLL. Grow up and deal with it. It is free and rock-solid.

I do not know of any especially good Blitz-code collision systems, mainly because there's no great incentive for anyone to write one: it's quite hard to do well (and collisions are the sort of thing you really want to optimise hard). StevieG's game "Polymaniacs" used - at least the last time I played a demo - a full physics engine implemented purely in B3D, but it just used native collisions behind-the-scenes and had the same limitations (dynamic objects had to be made out of groups of spheres).

What problem are you trying to solve that is too difficult to handle with the native collision system?


Cubed Inc.(Posted 2012) [#3]
Thanks for the totally mature answer. It's sad how people can get offended by something so minor. I'll take your advice,since I was unaware of the DLL you suggested, but you need to think before you write and purposly try to offend someone. I want you to think about that.

Good day.

Last edited 2012


Yasha(Posted 2012) [#4]
Thanks for the totally mature answer. It's sad how people can get offended by something so minor. I'll take your advice,since I was unaware of the DLL you suggested, but you need to think before you write and purposly try to offend someone. I want you to think about that.

Good day.


OK, before you were being silly, but this is an unacceptable response. Don't expect further help if you're going to take this ridiculous attitude.

Grow. Up.


Cubed Inc.(Posted 2012) [#5]
Can you cut it with the Grow Up? The irony is killing me. As for an unacceptable response, YOU are the one who started to get insulting. If you were as mature as you make yourself out to be, you would have simply said that you disagreed with my opinion on DLLs. You didn't have to act like a little kid that had his favorite superhero talked badly about or something.

You are indeed the one that needs to grow up.


RemiD(Posted 2012) [#6]
TaGames>>
From my tests so far, with Blitz3d you can have/detect collisions between :
->moving collider sphere vs static collider mesh (low tris is better)
->moving collider sphere vs moving collider sphere

As Yasha explained, if you want to have/detect collisions between 2 moving entities, you need to use one or several colliders sphere on them.

When there is only one moving collider sphere against one static collider mesh or against one moving collider sphere, the collisions calculations and reponses behave correctly because you can set the collider sphere as the parent of the entity. (you move the collider)

However when you have to use several colliders sphere to create an approximate collider around the mesh, there can be some errors because you have to set the colliders sphere as childs of the entity and to use ResetEntity() after a collision occurs in order to be able to reposition each collider sphere at their correct position/orientation. (you move the entity)
This can provoke errors because when you use ResetEntity() the collision response is off during one frame.

I have found that when using several colliders sphere as childs of a mesh, it is better to use the collision response "Stop" and then to reposition the entity and the others colliders sphere with the help of TFormPoint().



Yasha>>What kinds of collisions have you managed to do with Coldet ?
I'm especially curious about the possible shapes for a moving collider vs another moving collider and also about the collisions responses.



Does any of you have the NuclearGlory dll or source for collisions ? I haven't found a link where to download it.
See : http://blitzbasic.com/Community/posts.php?topic=31208#332756

Last edited 2012


Rroff(Posted 2012) [#7]
I've not tested it beyond the demo but blitzbullet seems solid, fast and very feature rich.

TBH with any kinda modern game you are gonna have to go beyond whats realistically possible with native B3D code, JVODE seems a fairly solid physics engine to although there are some random crashes with it in extensive use. Neither of these are free tho.

Coldet does seem pretty popular and reputedly robust tho I've not tried it myself.


Cubed Inc.(Posted 2012) [#8]
Thanks you Rroff and RemiD. I'm now convinced that DLL are not bad and can really aid when programming. No need to insult or be offended. Now i've chanced my mind on DLLS. I find them to be quite usefull.


Charrua(Posted 2012) [#9]
some time ago i tested a "dynamic collision system" made by Simon Harrison, all b3d code, wich has it's limitation but gives some interesting reults, depending on what are you trying to do it could has a chance.

undubtly, a physics engine is better, but i recall this code just in case.

include file : "dcol_lib.bb"


test program (made by me (mostly based on the original demo))



just use arrows keys to move the player

regards

Juan

Last edited 2012


Yasha(Posted 2012) [#10]
Yasha>>What kinds of collisions have you managed to do with Coldet ?
I'm especially curious about the possible shapes for a moving collider vs another moving collider and also about the collisions responses.


The main use I have had for ColDet was in a simulation involving a C-shaped arm with four degrees of freedom (all the rotational axes, also moving in Z), twisting and turning around a floating worktop with three degrees of freedom (linear movement in three axes). Both using mesh-based polygonal colliders rather than geometric ones. I tested it pretty hard and had no problems with either stability or performance, both directly controlling the objects to ram them into each other, and with a solver trying to handle scripted animation targets. I did construct some more complex scenes as well, but didn't really stress-test them as much.

In other words, I am confident that it can handle any dynamic object-object collisions very easily. However, there is a catch when it comes to responses: ColDet doesn't include them - it's a detection library, not a response library. This means no support for sliding collisions, and very limited support for stop-collisions. For my purposes this was no problem as I only needed stop-collisions, and could guarantee than my objects moved slowly enough that they wouldn't actually miss a collision by moving straight through the target object. If however you need a detailed collision response like sliding, or to know when one object would have completely passed through another one, ColDet will not work for you - it really only detects intersections and has no built-in concept of movement. This is what enables it to be so ridiculously fast compared to libraries that do include those things, like B3D itself.

To help integrate it with more traditional code, I made a modified version of the ColDet.bb file:



It's a B3D-like interface that adds the following commands:

ColDet_ListAdd(entity, colType): Add a B3D entity to the ColDet system
ColDet_ListRemove(entity): Remove a B3D entity from the ColDet system
ColDet_CreateCollider(entity, colType): Add a non-rendering B3D entity as a collider
ColDet_SetCollisionPair(t1, t2): Define collision detection between two B3D-style collision types (i.e. arbitrary numbers)
ColDet_TypesCollide(t1, t2): Check if two types have a response set
ColDet_GetColDetEntity(entity): Get the ColDet internal collision object attached to a B3D entity (not normally needed)
ColDet_GetColDetType(entity): Check the collision type of an entity
ColDet_GetColDetPickmode(entity): Check if an entity is pickable
ColDet_SetColDetPickMode(entity, mode): Set whether an entity is pickable
ColDet_GetCollider.Collider(entity): Get the collider associated with an entity (internal, not normally needed)
ColDet_CameraPick(camera, viewX, viewY, viewW, viewH): CameraPick a ColDet-enabled and pickable entity
ColDet_MoveEntity(entity, x#, y#, z#): Move an entity, subject to ColDet collision
ColDet_TurnEntity(entity, pitch#, yaw#, roll#): Turn an entity, subject to ColDet collision
ColDet_EntityCollided(entity): Test if an entity is currently involved in a collision (not needed if using the above two functions)
ColDet_ResetAll(): Update all collision entities to wherever their Blitz entities are right now, not colliding on the way (like ResetEntity)

As long as you use ColDet_Start and ColDet_End as normal (to initialise and deinitialise the engine), you can avoid using ColDet's own commands.

Not however that this thin wrapper is 1. subject to the same limitations as ColDet ("collisions" are actually intersections, and if one is the result of movement, the movement is just undone rather than partially-completed; moving all the way through a target will therefore not register), and 2. highly inefficient for more than a small number of colliders, as it involves a lot of list iterations (O(n^2) - for a large number of collision check this will make it significantly slower than B3D's builtin system).


RemiD(Posted 2012) [#11]
Rroff>>Blitzbullet seems to have interesting functionalities indeed, i will try it. Thanks



TaGames>>It depends on what you want to achieve, but Blitz3d collisions works well if you don't need physics behaviors.



Charrua>>It shows that it is possible to push a collider sphere with a collider box in Blitz3d... I have to study this code. Thanks.




In other words, I am confident that it can handle any dynamic object-object collisions very easily. However, there is a catch when it comes to responses: ColDet doesn't include them - it's a detection library, not a response library. This means no support for sliding collisions, and very limited support for stop-collisions.



Yasha>>
Ok i understand what you mean. That's not useful for my current program. I need a kind of collider capsule which has a sliding reponse (for characters) I try to achieve this effect with several colliders sphere.

Last edited 2012