Anchor

Anchor is a simple script that keeps a Rigidbody anchored to a point where the anchor was dropped through a physics joint. It approximates the behavior of a real anchor by keeping the object near the anchored position while allowing some movement, and can drag on the seafloor if forces exceed a threshold.
Fields
dropOnStart- Should the anchor be dropped automatically at the start of the scenelocalAnchorPoint- Point in coordinates local to the object this script is attached to. Defines where on the ship the anchor chain is attachedzeroForceRadius- Radius around the anchor in which the chain/rope is slack and no force will be applied. This allows small movements without resistanceforceCoefficient- Coefficient by which the force will be multiplied when the object starts pulling on the anchor. Controls the strength of the anchoring forcedragForce- Maximum force that can be applied to the anchor before it starts to drag along the seafloor
Public Properties and Methods
Drop()- Drops the anchor. Sets the anchor position to the current anchor point positionWeigh()- Weighs (retracts) the anchor, allowing the object to move freelyDropped- Property indicating whether the anchor has been droppedIsDragging- Property indicating whether the anchor is currently dragging on the seafloor (force exceeds dragForce)AnchorPoint- World space position of the anchor attachment point on the shipAnchorPosition- Current world position of the anchor itself