physics test2
This commit is contained in:
+13
-11
@@ -63,22 +63,24 @@ class Hero{
|
||||
// //colliderBody.sleepSpeedLimit = 1.0;
|
||||
// gameEngine.phy.world.addBody(colliderBody)
|
||||
|
||||
let bodyDesc = RAPIER.RigidBodyDesc.kinematicPositionBased().setTranslation(
|
||||
// characterCollider.position.x,
|
||||
// characterCollider.position.y,
|
||||
// characterCollider.position.z
|
||||
-1, 3, 1
|
||||
)
|
||||
let rigidBody = gameEngine.phy.world.createRigidBody(bodyDesc);
|
||||
let dynamicCollider = RAPIER.ColliderDesc.ball(0.28);
|
||||
gameEngine.phy.world.createCollider(dynamicCollider, rigidBody.handle);
|
||||
let po = gameEngine.phy.add(this.model, 'kinematicPositionBased', false, undefined, 'ball', { radius: 0.28})
|
||||
|
||||
// let bodyDesc = RAPIER.RigidBodyDesc.kinematicPositionBased().setTranslation(
|
||||
// // characterCollider.position.x,
|
||||
// // characterCollider.position.y,
|
||||
// // characterCollider.position.z
|
||||
// -1, 3, 1
|
||||
// )
|
||||
// let rigidBody = gameEngine.phy.world.createRigidBody(bodyDesc);
|
||||
// let dynamicCollider = RAPIER.ColliderDesc.ball(0.28);
|
||||
// gameEngine.phy.world.createCollider(dynamicCollider, rigidBody.handle);
|
||||
|
||||
this.characterControls = new CharacterControls(this.model, this.mixer,
|
||||
this.animationsMap, gameEngine.orbitControls, gameEngine.camera, 'idle',
|
||||
new RAPIER.Ray(
|
||||
{ x: 0, y: 0, z: 0 },
|
||||
{ x: 0, y: -1, z: 0}
|
||||
), rigidBody, this.pointerControls)
|
||||
), po.rigidBody, this.pointerControls)
|
||||
|
||||
// this.characterCollider = characterCollider;
|
||||
// this.colliderBody = colliderBody;
|
||||
@@ -146,7 +148,7 @@ class Hero{
|
||||
this.delta += dlt;
|
||||
if (this.delta > 0.016){
|
||||
this.characterControls.update(this.gameEngine.phy.world, this.delta, pc)
|
||||
this.gameEngine.phy.world.step()
|
||||
this.gameEngine.phy.step()
|
||||
this.delta = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user