How to keep characters standing in physical systems

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(
 const impostorShape = new PhysicsShapeCylinder(
      new Vector3(0, -0.5, 0),
      new Vector3(0, 1.7, 0),
this.impostorPhysicsBody.shape = impostorShape
 this.impostorPhysicsBody.setMassProperties({ mass: 1 })
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

I recognize this scene :wink: You should try inertia: 0 when setting the mass of the object.

There was a discussion on the forum about this problem but I couldn’t find it back :confused:

Another solution is to set the target quaternion of the character to have the up vector always point up!

1 Like

yep, inertia at 0
You might find some usefull infos here : Character Controller with Physics V2 | by Babylon.js | Medium

Sorry if I’ve already pointed it :slight_smile:

1 Like

Do you make anouncments when you write new blog posts? Because I don’t want to miss them haha This is a great article!

We relay on X and Linkedin, mainly.

Thank you, my brother. Yes, when I set inertia to 0, I can make the object stand still

It would be nice to do it on the forum as well imo. Plenty of people don’t use Twitter or don’t use Linkedin for news ^^

No problemo :wink: I will add it to the template as well

Thank you, just set up inertia

1 Like