How to correctly assign a collision box?
Archives Forums/Blitz3D SDK Programming/How to correctly assign a collision box?
| ||
I'm assigning a collision box to an entity and i wondered what is the normal way of doing this? I'm assigning the box but it seems to be offset by a huge amount and not reflecting the cube it is assigned to. Here is some sample code that is part of a large object oriented api written in D but you should get the idea as i'm using the same parameters as the normal procedural function library. Cube StaticCube = new Cube(); StaticCube.SetTexture(new Texture("assets/textures/bricks.png")); StaticCube.Scale(5.0, 5.0, 5.0); StaticCube.Rotate(0, 45, 0); StaticCube.Position(100, 0, 100); StaticCube.SetCollisionType(COLLISION_SCENERY); StaticCube.SetCollisionBox(0, 0, 0, 10, 10, 10); Cube MovingCube = new Cube(); MovingCube.SetTexture(new Texture("assets/textures/wood.png")); MovingCube.Scale(5.0, 5.0, 5.0); MovingCube.Position(100, 0, 100); MovingCube.SetCollisionType(COLLISION_CHARACTER); MovingCube.SetCollisionBox(0, 0, 0, 10, 10, 10); As you can see i assign the collision box like this: MovingCube.SetCollisionBox(0, 0, 0, 10, 10, 10); //(x, y, z, width, height, depth) Any idea why the collision box is not reflecting the true position of the entity (cube)? The collision is occuring offset from the actual entity. |