Update Ammo.js Rigid Body when making manual position changes

I want to make little game with three.js

The scene is simple:

  • A character with a cubic dinamic body.
  • Walls with body.
  • And a floor with a body.

What i want is to directly modify the x/z axis of the player, handling the collisions with the walls somehow in the render loop.
Maybe ammo.js has a method to update the physical body when you make manual position changes.

I new in three.js… please someone help me :upside_down_face:

Usually you want to just set the velocity of the body according to player inputs, and let the engine handle collision. You can update the position yourself manually, but then you will jitter when u hit things, and sometimes fall through the floor, so you have to be judicious about when you do it.

It’s not that I want to do it in a different way than the traditional one. I am using the controls from the example three.js webgl - morphtargets - MD2 controls

Notice I’m using r76, an older version of three.js
The reason I use R79 is because it is easier to understand. I’m not new to JavaScript, but I am programming in 3D.

In the example, a script called MD2CharacterComplex.js is used to load a .MD2 model (3D model format with animation created for the Quake2 video game). After loading it adds controls to the character.
It’s perfect for me, but not for Ammo physics :frowning:

It’s a pain in the ass to manually set a rigidBody position, and the method depends on what kind of body it is: