Collision direction

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Jomkin
Prole
Posts: 8
Joined: Wed Jul 15, 2020 2:12 am

Collision direction

Post by Jomkin »

Hello,

I want to know if it is possible to dectect the direction of a collision.
I'm using love.physics : world:setCallbacks

But it only detects if the player is touching another body, not the direction.

What I want to do, is to have another animation when the player is touching a wall from the left, from the right, from the down or from the top.

Thank you in advance.
User avatar
pgimeno
Party member
Posts: 3550
Joined: Sun Oct 18, 2015 2:58 pm

Re: Collision direction

Post by pgimeno »

The contact's normal should give you a direction perpendicular and opposite the direction of contact.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 211 guests