Collision problem

BlitzMax Forums/MiniB3D Module/Collision problem

SLotman(Posted 2010) [#1]
I was just trying to port some old B3D code to miniB3D, and for the first time, to use the built in collision system - everything looked ok.

I create a "coin" in my game, and move it around. Once it hits a cube, this coin should reset to initial position. This is the code I use in B3D:

     HideEntity Coin
     PositionEntity Coin, oldX, EntityY(Coin), oldZ
     ShowEntity Coin


This put the coin back at 0,currentY, 0 on B3D. On MiniB3D, the coin keeps stuck where it collided!

Note that if I change the code, removing the collision type, it moves correctly:
     HideEntity Coin
     EntityType Coin,0
     PositionEntity Coin, oldX, EntityY(Coin), oldZ
     EntityType Coin,1
     ShowEntity Coin


The strangest part, is that the collision system do check if the entity is visible, and if it's not, it shouldn't collide... anyone knows what's going on after all?

Edit: here a small sample program showing the issue:

On this example the red cube should appear to the right of the green one, not on the left!

Last edited 2010


ima747(Posted 2010) [#2]
Odd... Should be able to use resetentity though... Think, haven't worked with collision directly in a while.


SLotman(Posted 2010) [#3]
Nope, ResetEntity does nothing either :(

From what I can see, if I move the cube after Updateworld, and before RenderWorld, it goes correctly - but after Renderworld, it bugs out; so it seems to be some logic problem :/

Last edited 2010


ima747(Posted 2010) [#4]
Huh, if you move it after update but before render it works, and stays in the position like it should? By moving it after updateworld it's collision will not be calculated until the next call of updateworld (which will happen after you draw it with renderworld) so it makes sense that it goes where it should then (since you're trying to bypass the collision) but if it stays there that's very strange since the next call to updateworld should collide it... however if you're "fixing" it after every updateworld then that would explain it... very odd that resetentity doesn't bypass 1 frame's collision as well...