# Physics Data

Support us as a GitHub Sponsor and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude.
These articles are made possible by our GitHub Sponsors ... become a sponsor today!

Creates and syncs physics data for an object beyond what is found in Unity's RigidBody. In particular the PhysicsData component will inspect all child mesh objects and create a related hull. Hull geometry is then used to calculate cross section, volumetric density, total volume and more.

Only used in editor, when enabled this will cause the gizmo system to drag bounding information and velocity information in the scene window.

public Mesh hullGeometry;

The hull geometry created by the Physics Data object. This is calculated from the child meshes of the object or when the Register Geometry method is called.

public float Mass => get;

The mass of the object as seen on the attached rigidbody

public float LinearDragCoefficient => get;

The linear drag as seen on the attached rigidbody. This is used to calculate quadratic drag effects.

public float AngularDragCoefficient => get;

The angular drag as seen on the attached rigidbody. This is used to calculate quadratic drag effects.

public float Density => get;

The average density of the body e.g. Mass / Volume

public float volume;

The volume of the geometry that makes up the body. This is calculated when hull geometry is calculated.

public float area;

The surface area of the hull geometry. This is calculated when hull geometry is calculated.

public float xCrossSection;

The effective cross section as seen from the X axis. This is calculated when hull geometry is calculated.

public float yCrossSection;

The effective cross section as seen from the Y axis. This is calculated when hull geometry is calculated.

public float zCrossSection;

The effective cross section as seen from the Z axis. This is calculated when hull geometry is calculated.

public Vector3 LinearHeading => get;

The direction of travel as seen from the rigidbody.

public float LinearSpeed => get;

The speed of travel as seen from the rigidbody;

public Vector3 LinearVelocity => get;

The linear velocity as seen from the rigidbody; This is the same as LinearSpeed * LinearHeading

public Vector3 AngularHeading => get;

The angular heading as seen from the rigidbody;

public float AngularSpeed => get;

The angular speed as seen from the rigidbody;

public Vector3 AngularVelocity => get;

The angualge velocity as seen form the rigidbody; This is the same as AngularSpeed * AngularHeading;

public Bounds Bounds => get;

The bounds of the hull geometry.

public Rigidbody AttachedRigidbody => get;

The attached rigidbody

public void RegisterGeometry(IEnumerable<MeshFilter> source);

Calculates a hull based on 1 or more MeshFilters and uses the resulting hull to calculate volume, surface area and other related features of the system.

Note that this does not respect the ignored meshes field. you are expected to hand this method only what should be calculated.

This method is called automatically on awake but can be called manually to force and update or for procedural bodies.

public float CrossSection(Vector3 direction);

Estimates the effective cross section as viewed from this direction.

public Vector3[] GetBoundCorners();

Gets the corners of the bounding box around the body based on the hull mesh

Last modified 1mo ago