Class Anchor
Approximates the behavior of a real anchor by keeping the object near the anchored position, but allowing for some movement.
Namespace: NWH.DWP2.ShipController
Assembly: NWH.DWP2.dll
Syntax
public class Anchor : MonoBehaviour
Fields
| Edit this page View SourcedragForce
Maximum force that can be applied to anchor before it starts to drag.
Declaration
[Tooltip("Maximum force that can be applied to anchor before it starts to drag.")]
public float dragForce
Field Value
| Type | Description |
|---|---|
| float |
dropOnStart
Should the anchor be dropped at start?
Declaration
[Tooltip("Should the anchor be dropped at start?")]
public bool dropOnStart
Field Value
| Type | Description |
|---|---|
| bool |
forceCoefficient
Coefficient by which the force will be multiplied when the object starts pulling on the anchor.
Declaration
[Tooltip("Coefficient by which the force will be multiplied when the object starts pulling on the anchor.")]
public float forceCoefficient
Field Value
| Type | Description |
|---|---|
| float |
localAnchorPoint
Point in coordinates local to the object this script is attached to.
Declaration
[Tooltip("Point in coordinates local to the object this script is attached to.")]
public Vector3 localAnchorPoint
Field Value
| Type | Description |
|---|---|
| Vector3 |
zeroForceRadius
Radius around anchor in which the chain/rope is slack and in which no force will be applied.
Declaration
[Tooltip("Radius around anchor in which the chain/rope is slack and in which no force will be applied.")]
public float zeroForceRadius
Field Value
| Type | Description |
|---|---|
| float |
Properties
| Edit this page View SourceAnchorPoint
World space position of the anchor attachment point on the ship.
Declaration
public Vector3 AnchorPoint { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
AnchorPosition
Position of the anchor.
Declaration
public Vector3 AnchorPosition { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Dropped
Has the anchor been dropped?
Declaration
public bool Dropped { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsDragging
Is the anchor dragging on the floor?
Declaration
public bool IsDragging { get; }
Property Value
| Type | Description |
|---|---|
| bool |
ParentRigidbody
Rigidbody to which the force will be applied.
Declaration
public Rigidbody ParentRigidbody { get; }
Property Value
| Type | Description |
|---|---|
| Rigidbody |
Methods
| Edit this page View SourceDrop()
Drops the anchor. Opposite of Weigh()
Declaration
public void Drop()
Weigh()
Weighs (retracts) the anchor.
Declaration
public void Weigh()