Physics global physical properties and auxiliary methods.
public static float bounceThreshold { get; set; }
Summary: Two Collicing Objects with a Relative Velocity Below this will not break (default 2). Must be positive.
Two collisions that are relatively lower than this value will not rebound (default 2). Must be positive.
public static float sleepThreshold { get; set; }
Abstract: The Mass-Normalized Energy Threshold, Below Which Objects Start Going to Sleep.
The energy threshold of
quality is lower than this threshold, and the object will enter the sleep state.
public static Vector3 gravity { get; set; }
Abstract: The gravity application to all right bodies in the scene.
public static bool autoSimulation { get; set; }
Abstract: Sets WHETHER the PHYSICS Should Be Simulated AutomaticAlly or Not.
OverlapSphere
Get the collision device within the spherical range.
Raycast
to detect whether the rays encounter an object and get this object.
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
bool b0 = Physics.Raycast(ray, out hit);
bool b1 = Physics.Raycast(ray, out hit, 500f);
bool b2 = Physics.Raycast(ray, out hit, 500f, 1 << 8);
bool b3 = Physics.Raycast(ray, out hit, 500f, 1 <<LayerMask.NameToLayer("Ground"));
bool b4 = Physics.Raycast(ray, out hit, 500f, ~(1 << 8));
Ray ray = new Ray(transform.position, transform.position + Vector3.forward*10);
bool b = Physics.Raycast(ray,Vector3.Distance(transform.position,transform.position+Vector3.forward*8));
RaycastAll
Get all the objects encountered in the rays.