true if the normal object's edge is curved
true if the 'primary' object's edge is curved
for debugging, unique code tells where this was generated
distance between objects; negative = penetration
Protected
distancedistance tolerance is used to decide when bodies are touching.
amount of force applied at a contact point
point of impact, in global coords
second impact point needed for Rope because the impact points are far apart. OPTIONAL point of impact on normalBody, in global coords
amount of impulse applied during collision
whether this is a bilateral constraint which can both push and pull
normal pointing outward from normalObj, in world coords
object corresponding to the normal (its edge defines the normal vector)
Private
normaledge of normal body
true = normal is constant
derivative of normal vector with respect to time
'primary' object whose corner or edge is colliding
Private
primaryedge of primary object
radius of curvature at impact1, for primary body; negative means concave
radius of curvature at impact1, for normal body; negative means concave
Private
u1_vector from primary body CM to primary edge's circle center, in world coords. Cached value to speed up performance.
Private
u2_vector from normal body CM to normal edge's circle center, in world coords. Cached value to speed up performance.
Protected
velocityvelocity tolerance used to determine if an object is in contact with another object. See ImpulseSim.getVelocityTol.
Returns true if this represents a bilateral constraint which can both push and pull; for example a Joint between two objects.
true if this is a bilateral constraint
Whether close enough to the point when this Collision can be handled.
The allowTiny
parameter exists because of cases where a
small distance collision cannot be backed-up in time to get near to the preferred
target 'half gap' distance.
regard as 'close enough' Collisions that have smaller distance than distance accuracy would normally allow
true if close enough to the point when this Collision can be handled.
Returns the elasticity used when calculating collisions; a value of 1.0 means perfect elasticity where the kinetic energy after collision is the same as before (extremely bouncy), while a value of 0 means no elasticity (no bounce). A collision uses the lesser elasticity value of the two bodies involved.
elasticity used when calculating collisions, a number from 0 to 1.
Returns point of impact on normal body, in global coords. For example, this is needed for Rope because the impact points are far apart. Often null when only Vertex.isEndPoint is needed.
point of impact on normal body, in global coords, or null
Returns the normal body involved in the collision, which defines the normal vector. The classic situation is that a vertex on the primary body is colliding into an edge on the normal body, but there are many variations on this.
the normal body involved in the collision
Returns the relative normal velocity based on current velocity of the bodies. Negative velocity means the objects moving towards each other, positive velocity means they are moving apart.
relative normal velocity between the two bodies at the point of contact.
Returns the primary body involved in the collision. The primary body does not define the normal. The classic situation is that a vertex on the primary body is colliding into an edge on the normal body, but there are many variations on this.
the primary body involved in the collision
Returns the difference in velocity of the two impact points of the collision based on current velocity of the bodies.
let V = velocity of center of mass (CM);
let R = distance vector CM to contact point
let w = angular velocity
w x R = (0, 0, w) x (Rx, Ry, 0) = (-w Ry, w Rx, 0)
velocity of corner = V + w x R = (Vx - w Ry, Vy + w Rx, 0)
relative velocity = Vab = Va + wa x Ra - Vb - wb x Rb
For curved edge we use the U
vector (from center of mass to edge's circle center)
instead of R
vector (from center of mass to point of impact). Because what matters is
not the motion of the individual point but instead the entire curved edge. Consider that
for a ball with center of mass at center of the circle, rotation doesn't change the
distance at all.
the velocity vector of this collision
Returns vector from center of mass of normal body to either point of impact or to center of circular edge in world coords. Uses the second impact point if appropriate.
vector from center of mass of normal body to either point of impact or to center of circular edge, in world coords
Whether this collision involves the given RigidBody
the RigidBody of interest
whether collision involves the given RigidBody
Whether this collision involves the given edge. If given edge is null, then always returns false.
the Edge of interest
whether collision involves the given Edge
Whether this collision involves the given vertex
the Vertex of interest
whether collision involves the given Vertex
Returns true if this represents a collision state, generally when two objects are interpenetrating. The collision search mechanism implemented by AdvanceStrategy.advance operates to set the simulation at a time very close to but just before any Collision is happening, see getEstimatedTime.
true
if this represents a collision state
Stores the time when this collision was detected, stores the current distance and velocity as the detected distance and detected velocity, and estimates when the collision occurred.
when this collision is detected
if the detected time has been previously set
Mark this Collision as one that needs handling because it is has caused the collision engine to backup in time in order to resolve this Collision. This is useful because after backing up in time, a Collision may no longer report itself as isColliding.
true if this Collision needs to be resolved
Returns whether this collision could be the same as another collision. Often there are several collisions found at a single location by the various collision detection mechanisms, and this is used when deciding which collision of those to keep.
the other collision
true if the two collisions are possibly the same collision
Updates the information in the collision to reflect current position and velocity of bodies. Changes the impact point to be the nearest point between the bodies (as long as this point is reasonably close to the original impact point). Then update the normal, R vectors, etc.
This is used when handling collisions because the collisions are found post-collision, but are handled pre-collision. Therefore, we need to update the information to correspond to the pre-collision arrangement of the bodies.
Doing this fixes inaccurate collisions; for example, a ball that hits a wall at an angle would wrongly acquire spin if the collision were not updated to the current pre-collision information.
Assumes that the bodies have been updated for their current location, by for example RigidBodySim.modifyObjects.
the current simulation time
Generated using TypeDoc
A RigidBodyCollision between two Edges.