Moving the jBullet collision body to with the player object
Posted
by
Kenneth Bray
on Game Development
See other posts from Game Development
or by Kenneth Bray
Published on 2012-10-31T23:15:31Z
Indexed on
2012/10/31
23:17 UTC
Read the original article
Hit count: 247
I am trying to update the location of the rigid body for a player class, as my player moves around I would like the collision body to also move with the player object (currently represented as a cube). Below is my current update method for when I want to update the xyz coords, but I am pretty sure I am not able to update the origin coords? :
public void Update(float pX, float pY, float pZ) {
posX = pX;
posY = pY;
posZ = pZ;
//update the playerCube transform for the rigid body
cubeTransform.origin.x = posX;
cubeTransform.origin.y = posY;
cubeTransform.origin.z = posZ;
cubeRigidBody.getMotionState().setWorldTransform(cubeTransform);
processTransformMatrix(cubeTransform);
}
I do not have rotation updated, as I do not actually want/need the player body to rotate at all currently. However, in the final game this will me put in place.
© Game Development or respective owner