Basic Question about EntityBox

Blitz3D Forums/Blitz3D Beginners Area/Basic Question about EntityBox

WERDNA(Posted 2009) [#1]
Hey!

I recently decided to change the collision method for robo attack
from ellipsoid-polygon, to ellipsoid-box for more perfect wall
collisions. I am confused about the parameters for EntityBox
though!

For the x,y and z position, is it the position within the entity?
Or the position within 3D space?

I.e, would I put it at 0,0,0 to locate it at the entitys center, or
Entityx(),EntityY(),and EntityZ() to locate it where the entity
currently is?

Thanks if you can help me out with this!

WERDNA


Gabriel(Posted 2009) [#2]
I'm not entirely clear how box is ever going to be better than polygon collision (as good as, possibly, but better than?) but I'll assume you've tested this and confirmed there's a benefit to be had.

Anywho, the coordinates are in local space, and - confusingly - should *not* be the center of the box. They should be the minx, miny, minz values.

IE: If you have a box from -1,-1,-1 to 1,1,1 then you would say:

EntityBox(MyBox,-1,-1,-1,2,2,2)


So essentially, the box starts at -1,-1,-1 (in local coordinates) and extends by 2,2,2 (and therefore finishes at 1,1,1)

I hope that makes sense.


Stevie G(Posted 2009) [#3]
For a standard blitz cube you would set the entitybox to be:

EntityBox, Cube, -1,-1,-1,2,2,2

Basically, the first params are the bottom/left/rear corner. It doesn't matter where you position the entity, the collisions will still work based on it's global position, and IIRC it's rotation.

It you're combining cubes to make a single surface level mesh then you'll need to stick with ellipsion / polygon collisions.

EDIT - Gabriel beat me to it.

Stevie


WERDNA(Posted 2009) [#4]
Ok, thanks guys!

That clears that up.
I'm not entirely clear how box is ever going to be better than polygon collision


I'm not using if entitycollide to check collisions. I was having too many
problems trying to get blitzes internal collision commands to work.
I'm using entitydistance or something custom made instead.

Box's will work better for what I have planned, but even I'm not entirely
sure what path I'm going to take. I just want to understand how to use
all of my options :)

WERDNA


Stevie G(Posted 2009) [#5]

I'm not using if entitycollide to check collisions. I was having too many
problems trying to get blitzes internal collision commands to work.
I'm using entitydistance or something custom made instead.



If you're not using internal collisions then what point does entitybox serve? What problems were you having?


WERDNA(Posted 2009) [#6]
If you're not using internal collisions then what point does entitybox serve?


None at all. But now that I know how to use it, I might try using
internal collisions again.

As to what problems I was having, when checking for collision with the
robots in robo attack, it was by using the following,

For Robot.Bot = each Bot
If EntityCollided(Bot\en,Player) = Bot\en
;Do something
End If
Next

It would work just fine most of the time, but occasionally would crash
the game with no error message other than memory access violation.
I had several blitzers look at it to, but they couldn't find anything wrong
with it, and said its probably an internal glitch with blitz.

I have to use If EntityCollided besides just setting up Collisions because
some of my objects, namely the walls, are rectangular instead of square.

So If EntityCollide allows me to refine the collision a bit, although due to
the glitch mentioned above, I haven't been able to :(

So I was thinking if I could get EntityBox to work, I could slap a rectangular box
over each wall, and that might make collisions a bit more exact.

Although I only have a vague idea of what I want to do. I need to think
about how to make this all come together.

WERDNA