Constrained rigid body
• Collision detection • Contact point • Colliding contact • Resting contact • Friction
Collision detection • Determine whether the collision occurs within a numerical tolerance • Determine all pairs of bounding boxes that overlap • Further check contact points between rigid bodies defined as convex polyhedra
Bisection Y ( t 0 ) Y ( t 0 + 1 2 ∆ t ) Y ( t c ) � Y ( t 0 + ∆ t )
Bounding boxes • Use bounding boxes to reduce the number of pairwise collision/contact determinations • If two bounding boxes have no overlap, no further comparisons are needed • Coherence can substantially improve the performance
Bounding boxes Sweep and sort algorithm I 5 I 6 I 3 I 4 I 1 I 2 b 3 b 5 b 1 e 5 e 1 b 6 b 2 e 3 b 4 e 6 e 4 e 2
Bounding boxes • Each bounding box i can be described as an interval ( b i , e i ) • Find all pairs of interval that intersect • All the b i and e i are sorted from lowest to highest in a list • Maintain an active list which is initially empty • Whenever b i is encountered, all intervals on the active list are output as overlapping with i , and i is added to the list
Bounding boxes Sweep and sort algorithm I 5 I 6 I 3 I 4 I 1 I 2
Quiz • How does sweep and sort extend to 3D cases? • A: Apply sweep and sort 3 times in x, y, and z directions, and take the union of overlapped pairs • B: Apply sweep and sort 3 times in x, y, and z directions, and take the intersection of overlapped pairs
Bounding boxes • We only need to do a full sort and sweep initially • What is the cost of the sorting process? • Subsequent comparisons can be improved by utilizing coherence • What is the best sorting algorithm for a nearly sorted list?
Convex polyhedra Two polyhedra do not inter-penetrate if and only if a separating plane between them exists Separating plane
Separating plane Check all possible edges or faces to find a separating plane at the very first time step or the first time the bounding boxes overlap
Convex polyhedra Utilize coherence by caching defining faces or defining edges Defining face Defining face Y ( t 0 ) Y ( t 0 + ∆ t )
Convex polyhedra The defining face no longer separate the polyhedra and a new separating plane must be found Defining face Defining face If no separating plane is found, an inter-penetration has occurred at some earlier time The simulator must back up until the collision time is determined
• Collision detection • Contact point • Colliding contact • Resting contact • Friction
Contact points • Once we determine which bodies contact, we also need to determine the exact contact points • We consider two types of contacts • vertex/faces • edge/edge
Contact points 4 vertex/face 2 vertex/face 2 edge/edge
Contact points p a ( t c ) p a ( t ) A A p b ( t c ) p b ( t ) B B ˆ n ˆ n Although p a ( t ) and p b ( t ) are coincident at time t c , the velocity of the two points may be different
Velocity of the contact point p a A p a ( t c ) = v a ( t c ) + ω a ( t c ) × ( p a ( t c ) − x a ( t c )) ˙ p b B p b ( t c ) = v b ( t c ) + ω b ( t c ) × ( p b ( t c ) − x b ( t c )) ˙ ˆ n v r = ˆ n ( t c ) · ( ˙ p a ( t c ) − ˙ p b ( t c )) This quantity gives the component of the relative velocity in the normal direction
Relative normal velocity v r > 0 v r = 0 v r < 0 Separation Resting contact Colliding contact p a ( t c ) − ˙ ˙ p a ( t c ) − ˙ ˙ p a ( t c ) − ˙ ˙ p b ( t c ) p b ( t c ) p b ( t c ) A A A B B B ˆ ˆ ˆ n n n
• Collision detection • Contact point • Colliding contact • Resting contact • Friction
Collision process ∆ t no force no force � Impulse: f dt = J = M ∆ v
A soft collision Force Velocity ∆ V ∆ t
A harder collision Force Velocity ∆ V ∆ t
An infinitely hard collision Force Velocity ∆ V ∆ t = 0 f imp = ∞ f imp ∆ t = J
Impulse force • In the rigid body world, we want velocity to change instantaneously • use finite impulse to change velocity instead of infinite force • J = Δ P = M Δ v
Impulsive torque • If the impulse acts on a point p , J produces an impulsive torque • τ imp = ( p - x ( t )) × J • impulsive torque gives rise to a change in angular momentum: τ imp = Δ L
Colliding contact A j ˆ n B ˆ n For frictionless bodies, the direction of the impulse will be in the normal direction ˆ n ( t c ) J = j ˆ n ( t c ) If we can solve for j , we then can compute the velocity of the rigid body after the collision Body A is subject to this impulse J , while body B is subject to an equal but opposite impulse - J
Colliding contact v r < 0 A B ˆ n When two bodies collide, we apply an impulse between them to change their linear and angular momentum such that the penetration doesn’t happen in the next time step: v + r = − � v − r
The empirical law v + r = − � v − r Coefficient of restitution: � = 0 � = 0 Resting contact � = 0 . 5 V − � = 1 r � = 1 Perfect bounce A B ˆ n
Colliding contact p + p + ˙ a ( t c ) − ˙ b ( t c ) ˙ a ( t c ) − ˙ b ( t c ) p − p − A A before after j ˆ n B collision B collision ˆ n ˆ n Relative normal velocity before and after the application of the impulse r = ˆ n ( t c ) · ( ˙ a ( t 0 ) − ˙ b ( t 0 )) v − p − p − v + p + p + r = ˆ n ( t c ) · ( ˙ a ( t 0 ) − ˙ b ( t 0 ))
Compute the impulse Define the displacements from center of mass of the body and r a = p a ( t c ) − x a ( t c ) r b = p b ( t c ) − x b ( t c ) The pre-impulse velocity of p a : ˙ a = v − a ( t c ) + ω − a ( t c ) × r a p − p + a = v + a ( t c ) + ω + The post-impulse velocity of p a : ˙ a ( t c ) × r a a ( t c ) + j ˆ n ( t c ) v + v + p + Replace with in a ( t c ) a ( t c ) = v − ˙ a ( t c ) M a ω + a ( t c ) + I − 1 ( t c )( r a × j ˆ Replace with in ω + p + a ( t c ) a ( t c ) = ω − n ( t c )) ˙ a ( t c )
Compute the impulse � ˆ � n ( t c ) p + + ( I − 1 ˙ a ( t c ) = ˙ a + j a ( t c )( r a × ˆ n ( t c ))) × r a p − M a ✓ ˆ n ( t c ) ◆ p + + ( I − 1 ˙ b ( t c ) = ˙ b ( t c )( r b × ˆ n ( t c ))) × r b p − b − j M b v + p + p + r = ˆ n ( t c ) · ( ˙ a ( t c ) − ˙ b ( t c )) b ( t c )) + j ( 1 + 1 n ( t c ) · ( I − 1 = ˆ n ( t c ) · ( ˙ a ( t c ) − ˙ + ˆ a ( t c )( r a × ˆ n ( t c ))) × r a + p − p − M a M b n ( t c ) · ( I − 1 ˆ b ( t c )( r b × ˆ n ( t c ))) × r b ) r + j ( 1 + 1 n ( t c ) · ( I − 1 n ( t c ) · ( I − 1 = v − +ˆ a ( t c )( r a × ˆ n ( t c ))) × r a +ˆ b ( t c )( r b × ˆ n ( t c ))) × r b ) M a M b r + j ( 1 + 1 n ( t c ) · ( I − 1 n ( t c ) · ( I − 1 +ˆ a ( t c )( r a × ˆ n ( t c ))) × r a +ˆ b ( t c )( r b × ˆ n ( t c ))) × r b ) = − � v − v − r M a M b
Compute the impulse − (1 + � ) v − r j = 1 1 n ( t c ) · ( I − 1 n ( t c ) · ( I − 1 M a + M b + ˆ a ( t c )( r a × ˆ n ( t c ))) × r a + ˆ b ( t c )( r b × ˆ n ( t c ))) × r b ) Now we can compute the impulse and impulsive torque for body A and B A: B: J = j ˆ n ( t c ) J = − j ˆ n ( t c ) τ imp = r a × J τ imp = r b × J Finally, apply the change in linear momentum and angular momentum to the current state P ( t c + h ) = P ( t c ) + J L ( t c + h ) = L ( t c ) + τ imp
• Collision detection • Contact point • Colliding contact • Resting contact • Friction
Resting contact • In this case, all n contact points have the zero relative velocity • At each contact point there is some force , f i ˆ n ( t c ) where f i is an unknown scalar • Our goal is to determine what each f i is and all the f i ’s must be determined at the same time
Resting contact • To solve for f i , we need to consider • three relations between acceleration of the contact points and the contact forces • all the f i that are in contact at the same time
Non-penetration d i ( t ) = ˆ n i ( t ) · ( p a ( t ) − p b ( t )) p a ( t ) p b ( t ) p a ( t ) p b ( t ) p b ( t ) A A A B B p a ( t ) B ˆ ˆ ˆ n n n d i ( t ) > 0 d i ( t ) = 0 d i ( t ) < 0 This is what we want to avoid
Non-penetration d i ( t ) = ˙ ˙ n i ( t ) · ( p a ( t ) − p b ( t )) + ˆ ˆ n i · ( ˙ p a ( t ) − ˙ p b ( t )) At time t c , p a ( t c ) = p b ( t c ) This means that ˙ d i ( t c ) = v r The definition of two bodies in resting contact: d i ( t c ) = ˙ d i ( t c ) = 0
Non-penetration d i ( t c ) = ˙ When d i ( t c ) = 0 ¨ If , the bodies have an acceleration towards each other d i ( t c ) < 0 and the penetration will occur Therefore, the first condition is ¨ d i ( t c ) ≥ 0
Repulsive force The contact forces can push bodies apart, but can never act like “glue” and hold bodies together Therefore, each contact force must act outward f i ≥ 0
Recommend
More recommend