Nez.Portable/ECS/Components/Physics/ArcadeRigidbody.cs
/// <summary>
/// handles the collision of two non-overlapping rigidbodies. New velocities will be assigned to each rigidbody as appropriate.
/// </summary>
/// <param name="other">Other.</param>
/// <param name="inverseMTV">Inverse MT.</param>
handles the collision of two non-overlapping rigidbodies. New velocities will be assigned to each rigidbody as appropriate.
handles the collision of two non - overlapping rigidbodies . New velocities will be assigned to each rigidbody as appropriate .
void processCollision(ArcadeRigidbody other, ref Vector2 minimumTranslationVector)
        {
            var relativeVelocity = velocity - other.velocity;
            calculateResponseVelocity(ref relativeVelocity, ref minimumTranslationVector, out relativeVelocity);
            var totalInverseMass = _inverseMass + other._inverseMass;
            var ourResponseFraction = _inverseMass / totalInverseMass;
            var otherResponseFraction = other._inverseMass / totalInverseMass;
            velocity += relativeVelocity * ourResponseFraction;
            other.velocity -= relativeVelocity * otherResponseFraction;
        }
void processCollision ( ArcadeRigidbody other , ref Vector2 minimumTranslationVector ) { var relativeVelocity = velocity - other . velocity ; calculateResponseVelocity ( ref relativeVelocity , ref minimumTranslationVector , out relativeVelocity ) ; var totalInverseMass = _inverseMass + other . _inverseMass ; var ourResponseFraction = _inverseMass / totalInverseMass ; var otherResponseFraction = other . _inverseMass / totalInverseMass ; velocity += relativeVelocity * ourResponseFraction ; other . velocity -= relativeVelocity * otherResponseFraction ; }
handles the collision of two non-overlapping rigidbodies.
handles the collision of two non - overlapping rigidbodies .
// we compute a response for the two colliding objects. The calculations are based on the relative velocity of the objects // which gets reflected along the collided surface normal. Then a part of the response gets added to each object based on mass. // now we use the masses to linearly scale the response on both rigidbodies
other
ArcadeRigidbody
None
Vector2
ref
inverseMTV
None