float NormalSpeed

robot_2Generated
code_blocksInput

Description

The NormalSpeed field in the PhysicsContact struct represents the speed component of a physics contact along the normal vector of the contact surface. This value is a float and indicates how fast the contact point is moving in the direction of the normal vector at the moment of contact.

Usage

Use the NormalSpeed field to determine the velocity of an object at the point of contact along the normal. This can be useful for calculating the impact force or for determining how an object should respond to a collision.

For example, if you are implementing collision response logic, you might use NormalSpeed to adjust the velocity of an object after a collision to simulate realistic physics behavior.

Example

// Example of accessing the NormalSpeed field from a PhysicsContact instance
PhysicsContact contact = GetPhysicsContact();
float speedAlongNormal = contact.NormalSpeed;

// Use the speedAlongNormal to determine collision response
if (speedAlongNormal > threshold)
{
    // Handle high-speed collision
    ApplyHighImpactResponse(contact);
}
else
{
    // Handle low-speed collision
    ApplyLowImpactResponse(contact);
}