See if this is any use, or if I've missed the point completely (need to use the CenterMesh function on loaded meshes, as opposed to CreateCube/Sphere, etc)...
BTW Replace the CreateCube with CreateSphere and enable to ScaleMesh line to get something like the screenshot in the first post...
BTW Replace the CreateCube with CreateSphere and enable to ScaleMesh line to get something like the screenshot in the first post...
; Use this for loaded meshes... Function CenterMesh (entity) FitMesh entity, -(MeshWidth (entity) / 2), -(MeshHeight (entity) / 2), -(MeshDepth (entity) / 2), MeshWidth (entity), MeshHeight (entity), MeshDepth (entity) End Function ; Parameters: camera used, mesh... Function BoxMesh (box, mesh) For s = 1 To CountSurfaces (mesh) surf = GetSurface (mesh, s) For vert = 0 To CountVertices (surf) - 1 vx# = VertexX (surf, vert) vy# = VertexY (surf, vert) vz# = VertexZ (surf, vert) ; lv* -- lowest vertex x/y/z ; hv* -- highest vertex x/y/z If vx < lvx# Then lvx = vx If vy < lvy# Then lvy = vy If vz < lvz# Then lvz = vz If vx > hvx# Then hvx = vx If vy > hvy# Then hvy = vy If vz > hvz# Then hvz = vz Next Next PositionEntity box, EntityX (mesh, 1), EntityY (mesh, 1), EntityZ (mesh, 1) FitMesh box, lvx, lvy, lvz, hvx * 2, hvy * 2, hvz * 2 RotateEntity box, EntityPitch (mesh, 1), EntityYaw (mesh, 1), EntityRoll (mesh, 1) End Function AppTitle "Cursors, A & Z..." Graphics3D 640, 480, 0, 2 cam = CreateCamera () cube = CreateCube () ;LoadMesh ("C:\Program Files\Blitz3D\samples\Blitz 3D Samples\Hi-Toro\Shooter\Shooter\msh\ship.x") CenterMesh (cube) MoveEntity cube, 0, 0, 5 light = CreateLight () MoveEntity light, -10, 2, 5 PointEntity light, cube Color 0, 255, 0 box = CreateCube () EntityColor box, 255, 0, 0 EntityAlpha cube, 0.25 EntityAlpha box, 0.25 ;ScaleMesh cube, 1, 1, 3 Repeat If KeyDown (203) TranslateEntity cube, -0.1, 0, 0 If KeyDown (205) TranslateEntity cube, 0.1, 0, 0 If KeyDown (200) TranslateEntity cube, 0, 0.1, 0 If KeyDown (208) TranslateEntity cube, 0, -0.1, 0 If KeyDown (30) TranslateEntity cube, 0, 0, 0.1 If KeyDown (44) TranslateEntity cube, 0, 0, -0.1 TurnEntity cube, 0.1, 0.2, 0.3 RenderWorld BoxMesh box, cube Flip Until KeyHit (1) End