2

This question could be asked to any math wizard, but I am playing around in flame( loads of fun ), so I allow myself to ask it here.

My math is rusty but I have tried using reflect and normalized, but I am way off here. Can you help, and maybe give a direction for both ScreenHitbox & CircleHitbox?

I have CircleHitbox and a collision:

  @override
  void onCollisionStart(
    Set<Vector2> intersectionPoints,
    PositionComponent other,
  ) {
    super.onCollisionStart(intersectionPoints, other);
        if (other is ScreenHitbox) {
          // velocity.reflect(other.position.normalized());
          // velocity.reflect(other.size.normalized());
       velocity.reflect(intersectionPoints.first.normalized());
      // return;
    }
  }

Update: looking for normal on the collision?

enter image description here

Gwhyyy
  • 7,554
  • 3
  • 8
  • 35
Chris G.
  • 23,930
  • 48
  • 177
  • 302

0 Answers0