I have issue with using physics engine with player, npcs and loaded model. See following example:
If you set const useCannon to true things go funky and player will fall thru floors. I have been reading documentation and all should be ok, but I don’t know what am I missing.
The purpose is that both the player and NPCs fall to the floor, and the player can control itself. When the player collides with an NPC, the physics will take effect. Player needs to be able to climb stairs and so on. Basic stuff.
Example is using Cannon but if Havok is better that will work too.
Thank you @carolhmj I’ll go with Havok. Seems to work great! Controls (mouse & keyboard) no longer works when using Havok. I’ll figure it out. There was another thread about controls with Havok, but it did not had mouse control either.
@bigrig your example looks great, but at this point CharacterController library feels little overkill. Is it documented somewhere or where does it comes from?
You’re updating the player’s position/rotation directly based on the keyboard/mouse inputs, right? Then you’ll need to set disablePreStep = false on the player’s physics body. We usually skip updating the physics body’s position with the mesh’s position to increase performance, but in this case it will be needed. Alternatively, you can use velocities to update the player, but this requires changing more stuff.