Hi,
Question:
How do I add multiple sources of physics forces/impulse to a character, while capping the max velocity from each source?
Context:
I’m creating a physics based ball character, similar to in this video (https://youtu.be/Bt8o4o0Icn4?t=164). This is what I want to achieve:
- The players input WASD movement speed is has a max cap. Lets say 100 velocity.
- When stepping on a speed boost platform, you accelerate up to 25 extra velocity for 2sec, able max of 125 velocity using both sources.
- Getting bumped by another physics character lunches you away, potentially adding up to 50 extra velocity.
Total velocity = WASD velocity + boost platform + other forces
With all forces having their individual max velocity/speed.
In other words, I want to stacking multiple sources of physics, and capping each max velocity from the sources. How would I structure this? Any ideas are appreciated!
Attempts so far:
This is how I can clamp the max velocity of (1) the WASD input movement, but the problem is that that all other sources is ignored when I’m at Max.
If I instead temporary increases the max speed to 125 for 2 seconds when touching a boost platform, I can’t be sure that the additionl 25 is used by the platfrom, but could be used up by more velocity from the WASD input movement.