Hello there!
We have some problems concerning positioning and collision.
We have defined classes for Elements (Level Elements like Forks, Straights, Curves for a Labyrinth-like game) which implement a Function that returns a node with all geometry info + RigidBodyControls added to it, so the returned node can be added to rootNode and to physicsSpace.
Well so much for the concept… the Problem is: as soon as i implement the collision related code, all elements appear not to get not positioned at all.
[java]
//------------------PHYSICS and COLLISION--------------------------------------
//Create Collisionshapes for all walls, considering the vertex-arrays defined above
SimplexCollisionShape wallLeftShape = new SimplexCollisionShape(
verticesLeftWall[0], verticesLeftWall[1], verticesLeftWall[2], verticesLeftWall[3]);
SimplexCollisionShape wallRightShape = new SimplexCollisionShape(
verticesRightWall[0], verticesRightWall[1], verticesRightWall[2], verticesRightWall[3]);
SimplexCollisionShape floorShape = new SimplexCollisionShape(
verticesFloor[0], verticesFloor[1], verticesFloor[2], verticesFloor[3]);
SimplexCollisionShape ceilingShape = new SimplexCollisionShape(
verticesCeiling[0], verticesCeiling[1], verticesCeiling[2], verticesCeiling[3]);
//Create RigidBodyControls
RigidBodyControl wallLeftControl = new RigidBodyControl(wallLeftShape, 0);
RigidBodyControl wallRightControl = new RigidBodyControl(wallRightShape, 0);
RigidBodyControl floorControl = new RigidBodyControl(floorShape, 0);
RigidBodyControl ceilingControl = new RigidBodyControl(ceilingShape, 0);
wallLeftControl.setApplyPhysicsLocal(true);
wallRightControl.setApplyPhysicsLocal(true);
floorControl.setApplyPhysicsLocal(true);
ceilingControl.setApplyPhysicsLocal(true);
//Add these to the node
node.addControl(wallLeftControl);
node.addControl(wallRightControl);
node.addControl(floorControl);
node.addControl(ceilingControl);
[/java]
Firstly i thought, that setApplyPhysicsLocal would glue the Physics Coordinate System to the one of the specified node, so that whenver the node gets positioned, its control objects will behave the same way, but this does not appear to work out.
I find it strange anyways, that the positioning of the geometries gets affected at all by adding controls to it.
May someone have a hint on how to fix this or why this may happen?
I am looking forward to your answers
Best Regards
mank319