love.physics getting collision force

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
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

love.physics getting collision force

Post by tsturzl »

I'm trying to find the measurement of force of a collision callback. Any ideas?

I looked at Contact objects, they'll provide friction information but not any information about forces or impulses.
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: love.physics getting collision force

Post by Boolsheet »

The postsolve callback (World:setCallbacks) has 2 additional parameters for each contact point.

Code: Select all

function postsolve(fixture1, fixture2, contact, ...)
	local impulses = {...}

	local point1_normal_impulses = impulses[1]
	local point1_tangent_impulses = impulses[2]

	-- The following can be nil if there's only one contact point.
	local point2_normal_impulses = impulses[3]
	local point2_tangent_impulses = impulses[4]
end
Shallow indentations.
Post Reply

Who is online

Users browsing this forum: No registered users and 221 guests