Collisions WTF?!
BlitzMax Forums/MiniB3D Module/Collisions WTF?!
| ||
I've probably missed something obvious here but it's got me scratching my head at the moment. Here's some code to illustrate the issue I'm having: Now if you keep your eye on the output, you'll notice that the fist set of results is 'off': It reports CollisionX wrongly as 0.0 when it is 0.5 and, similarly, the difference between EntityZ and CollisionZ is also different to all subsequent results. I'm prototyping a project where getting these values wrong even once is fatal, so this is a bit of a spanner in the works. Anyone want to point out what idiot thing I'm doing wrong? Results ======= Difference: 0.899999440 Collision X: 0.000000000 Difference: 1.89999938 Collision X: 0.500000000 Difference: 1.89999938 Collision X: 0.500000000 Difference: 1.89999938 Collision X: 0.500000000 Difference: 1.89999938 Collision X: 0.500000000... |
| ||
Im not sure how the collision works in mb3d, but if you are inside a flipped mesh, is that what is causing a collision? the fact you are in the middlle of it. try flipping it the right way and colliding against the outside :/ |
| ||
The flipped cube is there as a stand-in for a .b3d mesh which, in my actual project, exhibits the same sort of anomalies. |
| ||
Yes, it's a bug, well spotted. To fix, in TCollision.bmx, change line 197: If C_CollisionResponse(c_col_info,c_coll,response)=False Then Exit To this: If x=False Then Exit Now add the following line directly after line 164: Local x=C_CollisionResponse(c_col_info,c_coll,response) The bug was due to the C_CollisionResponse function being called too late, so that the CollisionX/Y/Z etc functions were always one call behind. |
| ||
Sweet! Thanks for the quick fix -- I guess iMiniB3D is identical and can be fixed in the same way, syntax aside? |
| ||
Yes, that's correct. |
| ||
lol open source is awesome :D |
| ||
I don't completely understand what transpired in this past conversation, but it makes me happy to see how awesome the community out here can put together –— and support —— some awesome stuff. Props to open source , simonh & sledge |