playMaker

Author Topic: Prevent add force multiplication  (Read 567 times)

Qbanyto

  • Full Member
  • ***
  • Posts: 137
  • Vista Larga, Paso corto
Prevent add force multiplication
« on: November 09, 2021, 12:51:14 PM »
When my enemy hits me i knock back 1 foot. if two enemies hit me at the same time,, i knock back 2 feet. if 15 enemies hit me at the same,  i knock back 15 feet.

how do i make it so i AWLAYS knock back ONLY 1 foot?

I have an "add force in opposite direction of enemy location" formula. i LOVE how this works but i need to add a limit on the force. a CAP if you will. How is this achieved? set velocity limit?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Prevent add force multiplication
« Reply #1 on: November 10, 2021, 11:14:13 AM »
Hi.
Maybe something like :

Get Velocity X
Float Clamp X
Set Velocity X

Qbanyto

  • Full Member
  • ***
  • Posts: 137
  • Vista Larga, Paso corto
Re: Prevent add force multiplication
« Reply #2 on: November 10, 2021, 09:17:29 PM »
Man…I’ve tried that already. I might up messed up somewhere. I will attempt again. Thanks.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Prevent add force multiplication
« Reply #3 on: November 11, 2021, 07:34:46 AM »
Hi.
A different way could be that the player handles the force. and enemies send events to the player force FSM then you can set the transition local so that it can only do the force once then have a delay (wait) and loop back to the state for the trigger event.