Tanoda
|
AnchorableBehaviours mix well with InteractionBehaviours you'd like to be able to pick up and place in specific locations, specified by other GameObjects with an Anchor component. More...
Public Types | |
enum | EventType { OnAttachedToAnchor = 100 , OnLockedToAnchor = 105 , OnDetachedFromAnchor = 110 , WhileAttachedToAnchor = 120 , WhileLockedToAnchor = 125 , OnPostTryAnchorOnGraspEnd = 130 } |
Public Member Functions | |
void | Detach () |
Detaches this Anchorable object from its anchor. The anchor reference remains unchanged. Call TryAttach() to re-attach to this object's assigned anchor. More... | |
bool | IsValidAnchor (Anchor anchor) |
Returns whether the argument anchor is an acceptable anchor for this anchorable object; that is, whether the argument Anchor is within this behaviour's AnchorGroup if it has one, or if this behaviour has no AnchorGroup, returns true. More... | |
bool | IsWithinRange (Anchor anchor) |
Returns whether the specified anchor is within attachment range of this Anchorable object. More... | |
Anchor | FindPreferredAnchor () |
Attempts to find and return the best anchor for this anchorable object to attach to based on its current configuration. If useTrajectory is enabled, the object will consider anchor proximity as well as its own trajectory towards a particular anchor, and may return null if the object is moving away from all of its possible anchors. Otherwise, the object will simply return the nearest valid anchor, or null if there is no valid anchor nearby. More... | |
List< Anchor > | GetNearbyValidAnchors (bool requireAnchorHasSpace=true, bool requireAnchorActiveAndEnabled=true) |
Returns all anchors within the max anchor range of this anchorable object. If this anchorable object has its anchorGroup property set, only anchors within that AnchorGroup will be returned. By default, this method will only return anchors that have space for an object to attach to it. More... | |
Anchor | GetNearestValidAnchor (bool requireWithinRange=true, bool requireAnchorHasSpace=true, bool requireAnchorActiveAndEnabled=true) |
Returns the nearest valid anchor to this Anchorable object. If this anchorable object has its anchorGroup property set, all anchors within that AnchorGroup are valid to be this object's anchor. If there is no valid anchor within range, returns null. By default, this method will only return anchors that are within the max anchor range of this object and that have space for an object to attach to it. More... | |
bool | TryAttach (bool ignoreRange=false) |
Attempts to attach to this Anchorable object's currently specified anchor. The attempt may fail if this anchor is out of range. Optionally, the range requirement can be ignored. More... | |
bool | TryAttachToNearestAnchor () |
Attempts to find and attach this anchorable object to the nearest valid anchor, or the most optimal nearby anchor based on proximity and the object's trajectory if useTrajectory is enabled. More... | |
Static Public Member Functions | |
static float | GetAnchorScore (Vector3 anchObjPos, Vector3 anchObjVel, Vector3 anchorPos, float maxDistance, float nonDirectedMaxDistance, float minAngleProduct, float alwaysAttachDistance=0f) |
Calculates and returns a score from 0 (non-valid anchor) to 1 (ideal anchor) based on the argument configuration, using an anchorable object's position and velocity, an anchor position, and distance/angle settings. A score of zero indicates an invalid anchor no matter what; a non-zero score indicates a possible anchor, with more optimal anchors receiving a score closer to 1. More... | |
Public Attributes | |
float | maxAnchorRange = 0.3F |
bool | useTrajectory = true |
bool | lockToAnchor = false |
bool | lockWhenAttached = true |
bool | matchAnchorMotionWhileAttaching = true |
float | anchorLerpCoeffPerSec = 20F |
bool | anchorRotation = false |
InteractionBehaviour | interactionBehaviour |
bool | detachWhenGrasped = true |
bool | isAttractedByHand = false |
float | maxAttractionReach = 0.1F |
AnimationCurve | attractionReachByDistance |
Action | OnAttachedToAnchor = () => { } |
Called when this AnchorableBehaviour attaches to an Anchor. More... | |
Action | OnLockedToAnchor = () => { } |
Called when this AnchorableBehaviour locks to an Anchor. More... | |
Action | OnDetachedFromAnchor = () => { } |
Called when this AnchorableBehaviour detaches from an Anchor. More... | |
Action | WhileAttachedToAnchor = () => { } |
Called during every Update() in which this AnchorableBehaviour is attached to an Anchor. More... | |
Action | WhileLockedToAnchor = () => { } |
Called during every Update() in which this AnchorableBehaviour is locked to an Anchor. More... | |
Action | OnPostTryAnchorOnGraspEnd = () => { } |
Called just after this anchorable behaviour's InteractionBehaviour OnObjectGraspEnd for this anchor. This callback will never fire if tryAttachAnchorOnGraspEnd is not enabled. More... | |
Properties | |
bool | isAttached [get, set] |
Anchor | anchor [get, set] |
AnchorGroup | anchorGroup [get, set] |
bool | tryAnchorNearestOnGraspEnd [get, set] |
Anchor | preferredAnchor [get] |
Gets the anchor this AnchorableBehaviour would most prefer to attach to. This value is refreshed every Update() during which the AnchorableBehaviour has no anchor or is detached from its current anchor. More... | |
AnchorableBehaviours mix well with InteractionBehaviours you'd like to be able to pick up and place in specific locations, specified by other GameObjects with an Anchor component.
Definition at line 24 of file AnchorableBehaviour.cs.
Enumerator | |
---|---|
OnAttachedToAnchor | |
OnLockedToAnchor | |
OnDetachedFromAnchor | |
WhileAttachedToAnchor | |
WhileLockedToAnchor | |
OnPostTryAnchorOnGraspEnd |
Definition at line 816 of file AnchorableBehaviour.cs.
void Leap.Unity.Interaction.AnchorableBehaviour.Detach | ( | ) |
Detaches this Anchorable object from its anchor. The anchor reference remains unchanged. Call TryAttach() to re-attach to this object's assigned anchor.
Definition at line 383 of file AnchorableBehaviour.cs.
Anchor Leap.Unity.Interaction.AnchorableBehaviour.FindPreferredAnchor | ( | ) |
Attempts to find and return the best anchor for this anchorable object to attach to based on its current configuration. If useTrajectory is enabled, the object will consider anchor proximity as well as its own trajectory towards a particular anchor, and may return null if the object is moving away from all of its possible anchors. Otherwise, the object will simply return the nearest valid anchor, or null if there is no valid anchor nearby.
This method is called every Update() automatically by anchorable objects, and its result is stored in preferredAnchor. Only call this if you need a new calculation.
Definition at line 419 of file AnchorableBehaviour.cs.
|
static |
Calculates and returns a score from 0 (non-valid anchor) to 1 (ideal anchor) based on the argument configuration, using an anchorable object's position and velocity, an anchor position, and distance/angle settings. A score of zero indicates an invalid anchor no matter what; a non-zero score indicates a possible anchor, with more optimal anchors receiving a score closer to 1.
Definition at line 585 of file AnchorableBehaviour.cs.
List< Anchor > Leap.Unity.Interaction.AnchorableBehaviour.GetNearbyValidAnchors | ( | bool | requireAnchorHasSpace = true , |
bool | requireAnchorActiveAndEnabled = true |
||
) |
Returns all anchors within the max anchor range of this anchorable object. If this anchorable object has its anchorGroup property set, only anchors within that AnchorGroup will be returned. By default, this method will only return anchors that have space for an object to attach to it.
Warning: This method checks squared-distance for all anchors in teh scene if this AnchorableBehaviour has no AnchorGroup.
Definition at line 457 of file AnchorableBehaviour.cs.
Anchor Leap.Unity.Interaction.AnchorableBehaviour.GetNearestValidAnchor | ( | bool | requireWithinRange = true , |
bool | requireAnchorHasSpace = true , |
||
bool | requireAnchorActiveAndEnabled = true |
||
) |
Returns the nearest valid anchor to this Anchorable object. If this anchorable object has its anchorGroup property set, all anchors within that AnchorGroup are valid to be this object's anchor. If there is no valid anchor within range, returns null. By default, this method will only return anchors that are within the max anchor range of this object and that have space for an object to attach to it.
Warning: This method checks squared-distance for all anchors in the scene if this AnchorableBehaviour has no AnchorGroup.
Definition at line 491 of file AnchorableBehaviour.cs.
bool Leap.Unity.Interaction.AnchorableBehaviour.IsValidAnchor | ( | Anchor | anchor | ) |
Returns whether the argument anchor is an acceptable anchor for this anchorable object; that is, whether the argument Anchor is within this behaviour's AnchorGroup if it has one, or if this behaviour has no AnchorGroup, returns true.
Definition at line 392 of file AnchorableBehaviour.cs.
bool Leap.Unity.Interaction.AnchorableBehaviour.IsWithinRange | ( | Anchor | anchor | ) |
Returns whether the specified anchor is within attachment range of this Anchorable object.
Definition at line 404 of file AnchorableBehaviour.cs.
bool Leap.Unity.Interaction.AnchorableBehaviour.TryAttach | ( | bool | ignoreRange = false | ) |
Attempts to attach to this Anchorable object's currently specified anchor. The attempt may fail if this anchor is out of range. Optionally, the range requirement can be ignored.
Definition at line 539 of file AnchorableBehaviour.cs.
bool Leap.Unity.Interaction.AnchorableBehaviour.TryAttachToNearestAnchor | ( | ) |
Attempts to find and attach this anchorable object to the nearest valid anchor, or the most optimal nearby anchor based on proximity and the object's trajectory if useTrajectory is enabled.
Definition at line 554 of file AnchorableBehaviour.cs.
float Leap.Unity.Interaction.AnchorableBehaviour.anchorLerpCoeffPerSec = 20F |
Definition at line 177 of file AnchorableBehaviour.cs.
bool Leap.Unity.Interaction.AnchorableBehaviour.anchorRotation = false |
Definition at line 183 of file AnchorableBehaviour.cs.
AnimationCurve Leap.Unity.Interaction.AnchorableBehaviour.attractionReachByDistance |
Definition at line 229 of file AnchorableBehaviour.cs.
bool Leap.Unity.Interaction.AnchorableBehaviour.detachWhenGrasped = true |
Definition at line 195 of file AnchorableBehaviour.cs.
InteractionBehaviour Leap.Unity.Interaction.AnchorableBehaviour.interactionBehaviour |
Definition at line 189 of file AnchorableBehaviour.cs.
bool Leap.Unity.Interaction.AnchorableBehaviour.isAttractedByHand = false |
Definition at line 221 of file AnchorableBehaviour.cs.
bool Leap.Unity.Interaction.AnchorableBehaviour.lockToAnchor = false |
Definition at line 160 of file AnchorableBehaviour.cs.
bool Leap.Unity.Interaction.AnchorableBehaviour.lockWhenAttached = true |
Definition at line 166 of file AnchorableBehaviour.cs.
bool Leap.Unity.Interaction.AnchorableBehaviour.matchAnchorMotionWhileAttaching = true |
Definition at line 172 of file AnchorableBehaviour.cs.
float Leap.Unity.Interaction.AnchorableBehaviour.maxAnchorRange = 0.3F |
Definition at line 126 of file AnchorableBehaviour.cs.
float Leap.Unity.Interaction.AnchorableBehaviour.maxAttractionReach = 0.1F |
Definition at line 225 of file AnchorableBehaviour.cs.
Action Leap.Unity.Interaction.AnchorableBehaviour.OnAttachedToAnchor = () => { } |
Called when this AnchorableBehaviour attaches to an Anchor.
Definition at line 244 of file AnchorableBehaviour.cs.
Action Leap.Unity.Interaction.AnchorableBehaviour.OnDetachedFromAnchor = () => { } |
Called when this AnchorableBehaviour detaches from an Anchor.
Definition at line 254 of file AnchorableBehaviour.cs.
Action Leap.Unity.Interaction.AnchorableBehaviour.OnLockedToAnchor = () => { } |
Called when this AnchorableBehaviour locks to an Anchor.
Definition at line 249 of file AnchorableBehaviour.cs.
Action Leap.Unity.Interaction.AnchorableBehaviour.OnPostTryAnchorOnGraspEnd = () => { } |
Called just after this anchorable behaviour's InteractionBehaviour OnObjectGraspEnd for this anchor. This callback will never fire if tryAttachAnchorOnGraspEnd is not enabled.
If tryAttachAnchorOnGraspEnd is enabled, the anchor will be attached to an anchor only if its preferredAnchor property is non-null; otherwise, the attempt to anchor failed.
Definition at line 274 of file AnchorableBehaviour.cs.
bool Leap.Unity.Interaction.AnchorableBehaviour.useTrajectory = true |
Definition at line 132 of file AnchorableBehaviour.cs.
Action Leap.Unity.Interaction.AnchorableBehaviour.WhileAttachedToAnchor = () => { } |
Called during every Update() in which this AnchorableBehaviour is attached to an Anchor.
Definition at line 259 of file AnchorableBehaviour.cs.
Action Leap.Unity.Interaction.AnchorableBehaviour.WhileLockedToAnchor = () => { } |
Called during every Update() in which this AnchorableBehaviour is locked to an Anchor.
Definition at line 264 of file AnchorableBehaviour.cs.
|
getset |
Definition at line 72 of file AnchorableBehaviour.cs.
|
getset |
Definition at line 108 of file AnchorableBehaviour.cs.
|
getset |
Definition at line 30 of file AnchorableBehaviour.cs.
|
get |
Gets the anchor this AnchorableBehaviour would most prefer to attach to. This value is refreshed every Update() during which the AnchorableBehaviour has no anchor or is detached from its current anchor.
Definition at line 237 of file AnchorableBehaviour.cs.
|
getset |
Definition at line 203 of file AnchorableBehaviour.cs.