Need help with flipped mesh and collision

Blitz3D Forums/Blitz3D Programming/Need help with flipped mesh and collision

RustyKristi(Posted 2016) [#1]
If I have a cube with a scaled entity size of 100, 100, 100 (pos at 0,0,0) should my entitybox dimension be like -100,-100,100, 200,200,200 ?

What I'm doing is creating a map boundary so I created a cube and do a flipmesh.

I'm also having trouble with the flipped mesh thing, even though I applied disable backface culling using entityfx.


Bobysait(Posted 2016) [#2]
The box defined with entitybox is the box defining the mesh, not the entity !

So, if you scale/position/rotate the entity, the box will care about it.

If You do that for ex:
Local ent = CreateCube()
ScaleEntity ent, 200,33,127
PositionEntity ent, -2234,1278,52

The box is still -1,-1,-1,2,2,2

While if you perform transformation on the vertice, you 'll have to update the box accordingly.
(PositionMesh/ScaleMesh/FitMesh/RotateMesh or any VertexCoords stuff will modify the mesh, so the entitybox and entityradius should be updated to better fit the bouding volume)

So: the bouding volume (radius or box) is always to be considered for an unscaled entity that would virtually be at position 0,0,0 and without any kind of rotation.


-------------------------------------

Anyway, if you're trying to apply collision to the inner box, you won't get result unless you use the polygon mode.
-> inside of spheres or box are not taken into account, because, as mentionned above, it doesn't care about the mesh, it only cares about the entity transforms.

maybe you can try to set the box with negative values (?)
Never tried (as never needed), it may work or not ... it may also crash ...

-> EntityBox entity, 1,1,1, -2,-2,-2

or, you can try a ScaleEntity entity, -1,1,1 ( a single axis should be enough to flip the entity )
But as above, without any kind of warranty


-------------------------------------

[edit]
I 've read the blitz3d sources, it doesn't seem to perform any check for entitybox sign, so it should work with negative values.
But once again, no warranty. collision tests are done on the faces of the box with commun technics, like "If x<x0 Or x>x1" etc .. so it may lead to unpredictable results.


RemiD(Posted 2016) [#3]
Since with the Blitz3d collision system it is always ellipsoid collider against another shape, i say forget about entitybox and use a low details mesh as the collidable (like a fliped cube, or even better a rectangle mesh for each side (front, back, left, right) which act as a barrier)


RustyKristi(Posted 2016) [#4]
Thanks RemiD and Bobysait. I went with the x<x0 x>x1 solution instead as it is an easier solution. I could just do over and see what other options I can use later on.