Skip to main content
Discovery icon for Official Unity Discord Discord server

Official Unity Discord

32,909 Online
140,022 Members
# ๐Ÿ’ปโ”ƒcode-beginner4 people

implementing 2D knockback physics

Handling 2D knockback requires pausing constant velocity updates or using dynamic rigidbodies with force impulse and linear damping.

  • Constant linearVelocity assignments overwrite physics knockback and cause repeated collisions, requiring velocity to be disabled during hit stun
  • Dynamic rigidbodies need frozen Z constraints to stop unwanted rotation and linear damping to simulate drag when knocked back
  • Knockback force direction can be calculated using Collision2D relativeVelocity inverted with a multiplier
  • Shared behavior like health and hit cooldowns should be placed in an enemy base class, using virtual methods for boss variations
Summarized from recent messages, might be inaccurate

More conversations

Talk, Play, &
Hang Out

Find your space to hang out, discuss the latest updates with the party chat, and see who's down to join your next match.
Get App