playground #BCU1XR#1467 move with WASD
let me explain the what’s in the playground first.
-
Physics Engine is applied
-
In order to make a 3rd person camera, the hierarchy related to the dummy, dummy’s root, and the camera is as follow:
root
| => dummy
| => camera offset empty mesh
| => ArcRotateCameraif I use setTarget at line 225 in the playground instead of
camera.parent =
the model will jiggle. -
action manager used to take keyboard input
Then here is my problem.
Which of the four methods mentioned in the title should I used for the movement?
setPosition
is straight foward, calculated everything with current linear velocity and frametime,
but it makes me worried if it collides with other in the new position
setLinearVelocity
, implemented in the playground, at line 268, or change the flag at line 64 tryImpulse
to false
.
The problem with it is that it doesn’t account for the “from rest to move” acceleration, or you could bake that into the code but it then runs into the same problem with impulse or force.
applyImpulse
(implemented in playground) and applyForce
, both are more or less the same, the major problem with these two methods is how do you deal with change in direction.
If you apply a constant force along the direction of the camera, it takes quite some time to eliminate the forward momentum in the origin direction, so you would need to set a higher magnitude when there’s a change in direction but, the first search come up with biomechanics is a research paper…
Is it the only way if I want to emulate a realistic athlete? Take everything into account, angular velocities, maximum force asserted by the legs to the ground, etc.
Thanks in advance.