Good evening,everyone,
I have a character in the scene that I use directional keys to control, and I have activated the physics system HavokPhysics in the scene. I have set collisions for this character, and when a collision occurs, the character will tilt. How can I keep the character always standing,
The code is as follows
this.impostorPhysicsBody = new PhysicsBody(
this.transform,
PhysicsMotionType.DYNAMIC,
false,
scene
)
const impostorShape = new PhysicsShapeCylinder(
new Vector3(0, -0.5, 0),
new Vector3(0, 1.7, 0),
0.4,
scene
)
this.impostorPhysicsBody.shape = impostorShape
this.impostorPhysicsBody.setMassProperties({ mass: 1 })
this.impostorPhysicsBody.setAngularDamping(100)
this.impostorPhysicsBody.setLinearDamping(10)
this.impostorPhysicsBody.setGravityFactor(9.81)
const havokInstance = await HavokPhysics()
const havokPlugin = new HavokPlugin(true, havokInstance)
const scene = new Scene(engine)
scene.enablePhysics(new Vector3(0, -9.81, 0), havokPlugin)
I need your help, thank you very much