Jump to content

  • Log In with Google      Sign In   
  • Create Account

Irlan Robson

Member Since 08 May 2012
Offline Last Active Today, 03:46 AM

Posts I've Made

In Topic: Box 2d Normal Vector for the surface of impact?

19 May 2016 - 04:15 PM



For example, if a segment hits a face of a box, then the ray cast callback will be notified with the box, the face normal, and the intersection fraction which you can derive the intersection point from using linear interpolation:


p = (1.0 - fraction) * p1 + fraction * p2.

In Topic: Box 2d Normal Vector for the surface of impact?

17 May 2016 - 02:13 PM

1. Yes, and generally that would be the normal vector for every physics engine. However, it may be inverted if the wall is not treated as the first object in a collision internally. This is solved by flipping the normal. IIRC in B2D it can be acessed by requesting a world manifold from a contact.


2. Yes, a world has an interface for ray casts and AABB queries, and the former returns the surface normal if the ray/segment hits your vertical wall.

In Topic: Lagrange multiplier in constrained dynamics

29 April 2016 - 11:37 AM

I haven't watched that video completely, but I see that it follows Baraff's literature to solve for constraint *forces* (impulses / time_step). He uses essentially the same method as found in the constraint-based literature for non-penetration constraints using the LCP formulation. However, he uses quadratic programming (a global solver) to solve for the multipliers.


As Dirk said, you'll need to define your gradients (normals from the SAT for the collision case), each of which will be inserted into a Jacobian matrix for a general constraint-based system. From there you compute the lagrange multipliers as showed in Catto's slides. I think it is important to understand constraints geometrically when implementing these things. So yeah, we do look for a collision normal and point and only then we can find the force magnitude by relating it to the impulse-momentum law in Euler form and then we find the new relative velocities of each body after the collision/contact. 


BTW, different authors use the term impulse and force interchangeble, but assuming the force is constant during the time step then impulse = force * time_step. Therefore the lagrange multipliers both refer to the same thing.


(Do not take this too theoretical but here is an example without using Catto's simplification to solve for the multipliers (impulses) for a distance constraint.)

In Topic: Lagrange multiplier in constrained dynamics

27 April 2016 - 02:16 PM

Yeah, agree with Álvaro, he's mathematically wrong. He meant minimizing C towards zero for his equality (although that is wrong either; he meant keeping the constraint between the constraint bounds). 

In Topic: Lagrange multiplier in constrained dynamics

27 April 2016 - 05:38 AM

In a velocity-based formulation the Lagrangian multiplier is the magnitude of a constraint impulse, whereas in a acceleration-based formulation is the magnitude of a constraint-force. It is required to put the constraint into a valid state. Having the constraint configuration defined, it shouldn't be difficult to solve for it currently.


I don't understand what is the second question though. For example, an equality constraint (e.g. distance, ball-in-socket, or a revolute joint) is satisfied for C = 0.  A inequality constraint (i.e. contact, angle limits) is satisfied when lo <= C <= hi (actually that is the general form of a constraint). Therefore generally is valid to say we want to minimize C so that it remais satisfied all the time. 


Yeah, minimize g(x(t)).


BTW, that's a good article and he basically summarized some of Catto's and Witkin's papers intuitively.  :)