BGE: FIX T44328: Character motion actuator additive motion not working correct
Needs ReviewPublic

Authored by Thomas Szepe (hg1) on Apr 10 2015, 10:34 AM.

Details

Summary

If there are two character motion actuators are used to get a waking and running speed the two vectors of the actuators are not added together if are both active.
The motion actuator normalizes the vector, so two vectors in the same direction will have no (extra) affect.

This patch was created by Moguri in T40682.
The patch resets the walk direction every frame (if the feature is enabled).

Diff Detail

Thomas Szepe (hg1) retitled this revision from to BGE: FIX T44328: Character motion actuator additive motion not working.Apr 10 2015, 10:34 AM
Thomas Szepe (hg1) updated this object.

Motion vectors shouldn't generally be added together. You don't describe a use case, so I'm thinking of a motion actuator per motion key. However, pressing forward + sideward would then result in an approximately 1.4x (square root of 2) multiplication of your velocity.

Motion vectors shouldn't generally be added together.

Why not?

You don't describe a use case, so I'm thinking of a motion actuator per motion key.

I have describe a use case in the summary (walking/running speed).
New example:

  • First actuator (W key) Y + 0.004 normal forward motion = speed 0.004
  • First actuator (W key) Y + 0.004 + second actuator (W + left shift) Y + 0.004 active = running speed 0.008

However, pressing forward + sideward would then result in an approximately 1.4x (square root of 2) multiplication of your velocity.

No, this patch don't change the actual behaviour of the add button, It only fix the behaviour that actually it is not possible to add two motion in the same direction.
It does not slow down (approximately 1.4x square root of 2) if you move forward and sidewards at the same time.
We only sum the local vectors, the rest will be done in the Bullet engine.
ACT1 [0.0, 0.004, 0.0] + ACT2 [0.0, 0.004, 0.0] + ACT3 [0.004, 0.0, 0.0] = [0.004, 0.008, 0.0]

I use the same test file in T36703

for character motion.

Motion vectors shouldn't generally be added together.

Why not?

Because of these reasons: http://tvtropes.org/pmwiki/pmwiki.php/Main/DiagonalSpeedBoost

I have describe a use case in the summary (walking/running speed).
New example:

  • First actuator (W key) Y + 0.004 normal forward motion = speed 0.004
  • First actuator (W key) Y + 0.004 + second actuator (W + left shift) Y + 0.004 active = running speed 0.008

I agree that we should support different walking speeds, and that "add" should, indeed, add the motions.

No, this patch don't change the actual behaviour of the add button, It only fix the behaviour that actually it is not possible to add two motion in the same direction.
It does not slow down (approximately 1.4x square root of 2) if you move forward and sidewards at the same time.

I didn't mean a slowdown, but rather a speedup. If your walking speed is 1 m/sec, you could walk straight ahead with velocity (0, 1, 0) or straight right with velocity (1, 0, 0). If you were to add those two together, you'd move with velocity (1, 1, 0), which represents a speed of 1.4 m/sec.

Thomas Szepe (hg1) retitled this revision from BGE: FIX T44328: Character motion actuator additive motion not working to BGE: FIX T44328: Character motion actuator additive motion not working correct.
Thomas Szepe (hg1) updated this object.

I have normalized the speed, to get a correct speed if the x, y, and z values are different (elliptical position).

I didn't mean a slowdown, but rather a speedup. If your walking speed is 1 m/sec, you could walk straight ahead with velocity (0, 1, 0) or straight right with velocity (1, 0, 0). If you were to add those two together, you'd move with velocity (1, 1, 0), which represents a speed of 1.4 m/sec.

Yes you are right, was my fault. I should think before I write.

Test file for diagonal movement.

Actual my solution is also not good. Because it only works with two actuators.
But also the original version is working wrong. Because the movement speed is different if the left and forward speed is different. So the character moves with the speed which actuator was activated first. So if you activate first forward and then left, the movement speed is different to when you activate first left and then forward.

I think it is better to max out the speed and always move 45° angel forward and left is active.

Resigning as reviewer, as I don't have time for BGE work any more.