User Tools

Helper Scripts

Rigidbody Mass From Children

RigidbodyMassFromChildren inspector.

A helper script that calculates the mass of a Rigidbody from all the WaterObjects attached to it.
An example would be a trimaran - it has three hulls under one (parent) Rigidbody. If all three hulls have a Water Object the mass of the trimaran will be automatically calculated as the sum of the masses of all three hull Water Objects.

Center Of Mass

CenterOfMass inspector.

A helper script that adjusts the center of mass of a Rigidbody.
Unity calculates the center of mass as a geometrical center of all the colliders that are children of the Rigidbody which is correct only if the object is made out of a single material with no voids. In most cases Center Of Mass needs to be adjusted, especially with ships which are designed to have very low centers of mass to prevent tipping over to the side.
Current center of mass is indicated with a green sphere.


Anchor inspector.

Anchor is a helper script that imitates the behavior of an anchor.
It will try to keep the object in place exerting up to Drag Force at which point the anchor starts to drag and will move with the object, with the Drag Force being constantly applied in the direction of the anchor, pulling at the object. Once the object is outside of Zero Force Radius from the Anchor.Drop() point force will start to be applied as a function of the object distance from rim of the circle described by the Zero Force Radius.
Force Coefficient adjusts the amount of the force, while the Local Anchor Point adjusts where on the object the force will be applied (blue sphere gizmo).