playMaker

Author Topic: Which side was I hit? A knockback question...  (Read 1154 times)

HeathClose

  • Full Member
  • ***
  • Posts: 226
Which side was I hit? A knockback question...
« on: April 07, 2017, 07:13:54 PM »
So I have an elevated enemy shooting at my player...



the game is a runner... and my player is always moving to the right (except in my picture which I just realized I drew him going left  ::) )... unless of course it is interrupted by knockback... then it keeps moving after it recovers from the knockback...

I have the knockback set to -2.2 on the x and 1.9 on the y...

but what if the player get's hit in the back?  I want the impulse force to change it's direction for the knockback.... and deliver 2.2 on the x instead of -2.2

how can I figure out what side of the player I hit, so if the player is hit in the back... he is knocked forward not backwards... I need a way for the projectile prefab to know whether it's in front of or behind the player on contact.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Which side was I hit? A knockback question...
« Reply #1 on: April 10, 2017, 02:05:19 AM »
Hi,

 You can put two colliders, on on the left and on the right, deal with the differences and also forward the hit to a general hit manager for all the common tasks.

 Bye,

 Jean