The reason I use R79 is because it is easier to understand. I’m not new to JavaScript, but I am programming in 3D.
Those are screenshots of the scene running.
The solution was adding a box geometry for the player body ![]()
this.createPlayerRigidBody = function(player,mass) {
let scale = 25;
let playerBox = new THREE.BoxBufferGeometry(scale,scale,scale);
let weaponBox = new THREE.BoxBufferGeometry(0,0,0);
let playerBody = this.createMeshRigidBody(player.meshBody,mass,playerBox,0,0,0);
playerBody.setActivationState(4);
playerBody.setAngularFactor(0,1,0);
//let weaponBody = this.createMeshRigidBody(player.meshWeapon,mass,weaponBox,0,5,0);
};
The problem now is that I can’t directly modify the player’s position. I have to use physics.
and it’s very easy when you use just one mesh. But the md2 character has three 3d objects.
- a
THREE.Object3dthat is the root for all models. - a
THREE.MorphBlendMeshfor the character body. - and another
THREE.MorphBlendMeshfor the player’s weapon.
And when i try to move the body it becomes crazy.
A code modification in the MD2CharacterComplex.js file.
var scalingFactor = 20;
if (this.usingAmmo) {
let resultantImpulse = new Ammo.btVector3( Math.sin( this.bodyOrientation ) * forwardDelta, 0, Math.cos( this.bodyOrientation ) * forwardDelta )
resultantImpulse.op_mul(this.walkSpeed/10);
let physicsBody = this.meshBody.userData.physicsBody;
physicsBody.setLinearVelocity( resultantImpulse );
}
It doesn’t work ![]()
What I want to do is use the original code to move the character.
// this is inside the player movement function in MD2CharacterComplex.js
this.root.position.x += Math.sin( this.bodyOrientation ) * forwardDelta;
this.root.position.z += Math.cos( this.bodyOrientation ) * forwardDelta;
this.root.rotation.y = this.bodyOrientation;
And update the position of the physical body every time the xz position changes.
Then ammo can do the collisions. ![]()

