91
Support / small collision detection problem
« on: December 14, 2005, 04:46:31 am »
hello egon, thanks for answering so quickly...(must be midnight in germany :? )
The direction is the south compared to the first orientation of the model...
I can rotate the model without problem, and this rotation will affect the direction but whether i push forward or backward, the model will always go more or less south (depending on the z axis of the object)...
Here is the constructor. Maybe it can help:
And here is the code i call in my game loop to update the model
Maybe it is related with getTransformedCenter().z?
Manu
The direction is the south compared to the first orientation of the model...
I can rotate the model without problem, and this rotation will affect the direction but whether i push forward or backward, the model will always go more or less south (depending on the z axis of the object)...
Here is the constructor. Maybe it can help:
Code: [Select]
public Player(Object3D obj, WorldInterface worldInterface, String playerName){
super(obj); // the md2 object
this.setCollisionMode(Object3D.COLLISION_CHECK_SELF|Object3D.COLLISION_CHECK_OTHERS);
this.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
this.rotateY((float)Math.PI*1.5f);
this.rotateMesh();
this.build();
this.setRotationMatrix(new Matrix());
this.worldInterface = worldInterface;
this.playerName = playerName;
this.keyMapper = worldInterface.getKeyMapper();
this.terrain = worldInterface.getTerrain();
this.theWorld = worldInterface.getTheWorld();
theWorld.addObject(this);
this.placeModel();
this.setSelectable(Object3D.MOUSE_SELECTABLE);
SimpleVector v = this.getTransformedCenter();
v.add(lightShift);
this.myLight = theWorld.addLight(v, 0f,0f,0f);
}
And here is the code i call in my game loop to update the model
Code: [Select]
[...]
if (mainPlayer){
theWorld.setLightIntensity(myLight,50,50,50);
x = this.getTransformedCenter().x;
z = this.getTransformedCenter().z;
poll();
moveModel(); // basically it calls the correct function depending on the keys pressed detected in poll()
}
[...]
placeModel(); // in my previous post
[...]
Maybe it is related with getTransformedCenter().z?
Manu