CountCollisions and CollisionEntity Returns Null

BlitzMax Forums/MiniB3D Module/CountCollisions and CollisionEntity Returns Null

RustyKristi(Posted 2016) [#1]
Although I find this given example to work on OpenB3D:

http://www.blitzbasic.com/b3ddocs/command.php?name=collisions&ref=goto


CountCollisions and CollisionEntity returns null when I add this to the code


markcw(Posted 2016) [#2]
Seems to work fine on ubuntu, although ellipsoid-to-sphere causes the ball to sink. Are you checking after UpdateWorld?

https://github.com/markcwm/openb3d.mod/blob/master/examples/blitz3d/Collisions.bmx


RustyKristi(Posted 2016) [#3]
Thanks munch, I have to check this in detail but seems to work ok now :D wow I think this is the simple and best example by far that used most of the collisions commands, this is just great!


RustyKristi(Posted 2016) [#4]
Hey munch, I got a question..

Is it really required that the
Collisions
command need to be inside the main loop? Just curious because this was not the case with my original b3d project or other implementation (which I didn't even noticed until know) but yeah with the example in the docs that I gave above it seems it does in some case.

btw, I got the CountCollision worked either before or after UpdateWorld


RustyKristi(Posted 2016) [#5]
I'm still having problems with collisions on my custom code, I got this in order

EntityType ..

Collisions ..

While
  
  UpdateWorld
  KeyControls
  UpdateMeshes()
  RenderWorld
  
Wend



My CountCollisions command is inside UpdateMeshes() and it works with Blitz3D version. I don't know what's the difference since it was derived from it.

My mesh declarations are inside a legacy Type variables conversion using Import Tool in MaxIDE.


markcw(Posted 2016) [#6]
Yes, I think with Openb3d you need to call UpdateWorld after move/anim commands, this is one case where it's different to in Blitz3d.


RustyKristi(Posted 2016) [#7]
Hey munch, after some trials and testing I have managed to get it fixed with this setup:


While
    DeltaTimeFix()

    PlayerControls()
    AI/GameLogicStuff()
   
    UpdateEntityMovement()
    UpdateWorld
    UpdateEntityMovement()
    RenderWorld

    2D Stuff()
Wend


I'm using a timed delta to make it the same speed regardless of pc spec. Does it affect the setup above? I have to call UpdateEntityMovement (translate,rotate,move) twice, before and after updateworld just so the collision would finally work.


RemiD(Posted 2016) [#8]
this is not normal, you only have to turn move your entities once per loop, before detecting collisions, then you can reoriente reposition some entities depending on the collisions which have happened... But these are 2 different functions/procedures.


RustyKristi(Posted 2016) [#9]
Yes, I know that somehow but that applies to blitz3d only and do remember that openb3d just tries to simulate b3d features and not an exact copy (xyz on some commands are somehow different since it is opengl). Otherwise you'll be using that instead. ;-)

Try working on OpenB3D and see it for yourself RemiD! :-)


RemiD(Posted 2016) [#10]
if you have to do that to make it works, it means that either your code has error(s) somewhere (maybe you have not put the functions to detect collisions/reposition at the correct place) or openb3d has error(s) somewhere...