There seems to be a discrepancy between the origin of a mesh and the zero-points of the same mesh as applied to the function EntityBox. For instance:
The above code applies to a mesh with the origin at the bottom center.
But... no matter where the origin is of a mesh is placed, the same parameters that create a _visible_ bounding box should create a _pickable_ bounding box - but they don't!
Can anyone explain this?
Thanks... and be careful when using EntityBox!
width# = MeshWidth(Entity) height# = MeshHeight(Entity) depth# = MeshDepth(Entity) x# = EntityX(Entity) y# = EntityY(Entity) z# = EntityZ(Entity) ;Draw a ghost box around the mesh cube = CreateCube() ; Cube starts as 2x2x2 ScaleEntity cube,width/2,height/2,depth/2 PositionEntity cube,x,y+height/2,z RotateEntity cube,EntityPitch(Entity),EntityYaw(Entity),EntityRoll(Entity) EntityAlpha cube,0.3 EntityParent cube,Entity ;The ghost box perfectly encloses the mesh ;Set corresponding bounding box ;Same parameters as ghost box EntityBox Entity,0,height/2,0,width,height,depth ; wrong! ;But it doesn't work ;Translate the y and z coordinates by 1/2 their value EntityBox Entity,0,0,depth/2,width,height,depth ; right! ;Now it works!
The above code applies to a mesh with the origin at the bottom center.
But... no matter where the origin is of a mesh is placed, the same parameters that create a _visible_ bounding box should create a _pickable_ bounding box - but they don't!
Can anyone explain this?
Thanks... and be careful when using EntityBox!