![]() |
VR Interaction Framework v2.0
|
An object that can be picked up by a Grabber. More...
Public Member Functions | |
virtual void | Update () |
virtual void | FixedUpdate () |
virtual Vector3 | GetGrabberWithGrabPointOffset (Grabber grabber, Transform grabPoint) |
virtual Quaternion | GetGrabberWithOffsetWorldRotation (Grabber grabber) |
virtual bool | IsGrabbable () |
Is this object able to be grabbed. Does not check for valid Grabbers, only if it isn't being held, is active, etc. | |
virtual void | UpdateRemoteGrab () |
virtual void | CheckRemoteGrabLinear () |
virtual void | CheckRemoteGrabVelocity () |
virtual void | InitiateFlick () |
Vector3 | GetVelocityToHitTargetByTime (Vector3 startPosition, Vector3 targetPosition, Vector3 gravityBase, float timeToTarget) |
virtual void | CheckRemoteGrabFlick () |
virtual void | UpdateFixedJoints () |
virtual void | UpdatePhysicsJoints () |
virtual Vector3 | GetGrabberVector3 (Grabber grabber, bool isSecondary) |
virtual Quaternion | GetGrabberQuaternion (Grabber grabber, bool isSecondary) |
Vector3 | GetGrabbersAveragedPosition () |
Get the estimated world position of the grabber(s) holding this object. Position factors in 2-Handed grabbing options. | |
Quaternion | GetGrabbersAveragedRotation () |
virtual void | UpdateKinematicPhysics () |
virtual void | UpdateVelocityPhysics () |
Transform | GetGrabPoint () |
virtual void | GrabItem (Grabber grabbedBy) |
virtual void | GrabRemoteItem (Grabber grabbedBy) |
virtual void | ResetGrabbing () |
virtual void | DropItem (Grabber droppedBy, bool resetVelocity, bool resetParent) |
virtual void | DropItem (Grabber droppedBy) |
virtual void | DropItem (bool resetVelocity, bool resetParent) |
void | ResetScale () |
void | ResetParent () |
void | UpdateOriginalParent (Transform newOriginalParent) |
void | UpdateOriginalParent () |
ControllerHand | GetControllerHand (Grabber g) |
virtual Grabber | GetPrimaryGrabber () |
Returns the Grabber that first grabbed this item. Return null if not being held. | |
virtual Grabber | GetClosestGrabber () |
Get the closest valid grabber. | |
virtual Transform | GetClosestGrabPoint (Grabber grabber) |
virtual void | Release (Vector3 velocity, Vector3 angularVelocity) |
Throw the object by applying velocity. | |
virtual bool | IsValidCollision (Collision collision) |
virtual bool | IsValidCollision (Collider col) |
virtual void | parentHandGraphics (Grabber g) |
virtual BNGPlayerController | GetBNGPlayerController () |
A BNGPlayerController is optional, but if one is available we can check the last moved time in order to strengthen the physics joint during quick movements. This helps prevent jitter or flying objects in certain situations. | |
virtual void | RequestSpringTime (float seconds) |
Request the Grabbable to use a springy joint for the next X seconds. | |
virtual void | AddValidGrabber (Grabber grabber) |
virtual void | RemoveValidGrabber (Grabber grabber) |
virtual void | SubscribeToMoveEvents () |
Subscribe to any movement-related events that might cause our Grabbable to suddenly move far away. By subscribing to these events before they occur we can then respond better to these positional updates. | |
virtual void | UnsubscribeFromMoveEvents () |
virtual void | LockGrabbable () |
virtual void | LockGrabbableWithRotation () |
virtual void | RequestLockGrabbable () |
virtual void | RequestUnlockGrabbable () |
virtual void | ResetLockResets () |
virtual void | LockGrabbable (bool lockPosition, bool lockRotation, bool overridePriorLock) |
Keep the Grabbable's position and /or rotation in place. | |
virtual void | UnlockGrabbable () |
Allow the Grabbable to move. | |
Public Attributes | |
bool | BeingHeld = false |
Is this object currently being held by a Grabber. | |
GrabButton | GrabButton = GrabButton.Inherit |
Configure which button is used to initiate the grab. | |
HoldType | Grabtype = HoldType.Inherit |
'Inherit' will inherit this setting from the Grabber. 'Hold' requires the user to hold the GrabButton down. 'Toggle' will drop / release the Grabbable on button activation. | |
GrabPhysics | GrabPhysics = GrabPhysics.Velocity |
Kinematic Physics locks the object in place on the hand / grabber. PhysicsJoint allows collisions with the environment. | |
GrabType | GrabMechanic = GrabType.Precise |
Snap to a location or grab anywhere on the object. | |
float | GrabSpeed = 15f |
How fast to Lerp the object to the hand. | |
bool | RemoteGrabbable = false |
Can the object be picked up from far away. Must be within RemoteGrabber Trigger. | |
RemoteGrabMovement | RemoteGrabMechanic = RemoteGrabMovement.Linear |
float | RemoteGrabDistance = 2f |
Max Distance Object can be Remote Grabbed. Not applicable if RemoteGrabbable is false. | |
float | ThrowForceMultiplier = 2f |
Multiply controller's velocity times this when throwing. | |
float | ThrowForceMultiplierAngular = 1.5f |
Multiply controller's angular velocity times this when throwing. | |
float | BreakDistance = 0 |
Drop the item if object's center travels this far from the Grabber's Center (in meters). Set to 0 to disable distance break. | |
bool | HideHandGraphics = false |
Enabling this will hide the Transform specified in the Grabber's HandGraphics property. | |
bool | ParentToHands = false |
Parent this object to the hands for better stability. Not recommended for child grabbers. | |
bool | ParentHandModel = true |
If true, the hand model will be attached to the grabbed object. | |
bool | SnapHandModel = true |
bool | CanBeDropped = true |
Set to false to disable dropping. If false, will be permanently attached to whatever grabs this. | |
bool | CanBeSnappedToSnapZone = true |
Can this object be snapped to snap zones? Set to false if you never want this to be snappable. Further filtering can be done on the SnapZones. | |
bool | ForceDisableKinematicOnDrop = false |
bool | InstantMovement = false |
bool | MakeChildCollidersGrabbable = false |
HandPoseType | handPoseType = HandPoseType.HandPose |
HandPose | SelectedHandPose |
HandPoseId | CustomHandPose = HandPoseId.Default |
Animator ID of the Hand Pose to use. | |
OtherGrabBehavior | SecondaryGrabBehavior = OtherGrabBehavior.None |
What to do if another grabber grabs this while equipped. DualGrab is currently unsupported. | |
TwoHandedPositionType | TwoHandedPosition = TwoHandedPositionType.Lerp |
float | TwoHandedPostionLerpAmount = 0.5f |
TwoHandedRotationType | TwoHandedRotation = TwoHandedRotationType.Slerp |
float | TwoHandedRotationLerpAmount = 0.5f |
TwoHandedDropMechanic | TwoHandedDropBehavior = TwoHandedDropMechanic.Drop |
TwoHandedLookDirection | TwoHandedLookVector = TwoHandedLookDirection.Horizontal |
float | SecondHandLookSpeed = 40f |
Grabbable | SecondaryGrabbable |
Grabbable | OtherGrabbableMustBeGrabbed = null |
The Grabbable can only be grabbed if this grabbable is being held. Example : If you only want a weapon part to be grabbable if the weapon itself is being held. | |
float | CollisionSpring = 3000 |
How much Spring Force to apply to the joint when something comes in contact with the grabbable A higher Spring Force will make the Grabbable more rigid. | |
float | CollisionSlerp = 500 |
How much Slerp Force to apply to the joint when something is in contact with the grabbable. | |
ConfigurableJointMotion | CollisionLinearMotionX = ConfigurableJointMotion.Free |
ConfigurableJointMotion | CollisionLinearMotionY = ConfigurableJointMotion.Free |
ConfigurableJointMotion | CollisionLinearMotionZ = ConfigurableJointMotion.Free |
ConfigurableJointMotion | CollisionAngularMotionX = ConfigurableJointMotion.Free |
ConfigurableJointMotion | CollisionAngularMotionY = ConfigurableJointMotion.Free |
ConfigurableJointMotion | CollisionAngularMotionZ = ConfigurableJointMotion.Free |
bool | ApplyCorrectiveForce = true |
float | MoveVelocityForce = 3000f |
float | MoveAngularVelocityForce = 90f |
float | LastGrabTime |
Time in seconds (Time.time) when we last grabbed this item. | |
float | LastDropTime |
Time in seconds (Time.time) when we last dropped this item. | |
bool | AddControllerVelocityOnDrop = true |
Set to True to throw the Grabbable by applying the controller velocity to the grabbable on drop. Set False if you don't want the object to be throwable, or want to apply your own force manually. | |
List< Collider > | collisions |
GrabPoint | ActiveGrabPoint |
Returns the active GrabPoint component if object is held and a GrabPoint has been assigneed. | |
Vector3 | SecondaryLookOffset |
Transform | SecondaryLookAtTransform |
Transform | LocalOffsetTransform |
List< Transform > | GrabPoints |
If Grab Mechanic is set to Snap, the closest GrabPoint will be used. Add a SnapPoint Component to a GrabPoint to specify custom hand poses and rotation. | |
bool | UseCustomInspector = true |
Set this to false if you need to see Debug field or don't want to use the custom inspector. | |
float | lastFlickTime |
float | FlickForce = 1f |
Protected Member Functions | |
void | Awake () |
void | positionHandGraphics (Grabber g) |
virtual void | setupConfigJointGrab (Grabber grabbedBy, GrabType grabType) |
virtual void | setupFixedJointGrab (Grabber grabbedBy, GrabType grabType) |
virtual void | setupKinematicGrab (Grabber grabbedBy, GrabType grabType) |
virtual void | setupVelocityGrab (Grabber grabbedBy, GrabType grabType) |
Vector3 | getRemotePosition (Grabber toGrabber) |
Quaternion | getRemoteRotation (Grabber grabber) |
Protected Attributes | |
List< Grabber > | heldByGrabbers |
The grabber that is currently holding us. Null if not being held. | |
bool | wasKinematic |
Save whether or not the RigidBody was kinematic on Start. | |
bool | usedGravity |
CollisionDetectionMode | initialCollisionMode |
RigidbodyInterpolation | initialInterpolationMode |
bool | remoteGrabbing |
HandPoseType | initialHandPoseType |
HandPose | initialHandPose |
HandPoseId | initialHandPoseId |
Transform | primaryGrabOffset |
If Grab Mechanic is set to Snap, set position and rotation to this Transform on the primary Grabber. | |
Transform | secondaryGrabOffset |
Transform | originalParent |
InputBridge | input |
ConfigurableJoint | connectedJoint |
Vector3 | previousPosition |
float | lastItemTeleportTime |
bool | recentlyTeleported |
Collider | col |
Rigidbody | rigid |
Grabber | flyingTo |
List< GrabbableEvents > | events |
bool | didParentHands = false |
Properties | |
bool | BeingHeldWithTwoHands [get] |
Is this object currently being held by more than one Grabber. | |
List< Grabber > | HeldByGrabbers [get] |
bool | RemoteGrabbing [get] |
Is the object being pulled towards the Grabber. | |
Vector3 | OriginalScale [get] |
float | lastCollisionSeconds [get, protected set] |
float | lastNoCollisionSeconds [get, protected set] |
How many seconds we've gone without collisions. | |
bool | RecentlyCollided [get] |
Have we recently collided with an object. | |
float | requestSpringTime [get, protected set] |
Vector3 | GrabPositionOffset [get] |
Vector3 | GrabRotationOffset [get] |
Transform | grabTransform [get] |
Transform | grabTransformSecondary [get] |
bool | CanBeMoved [get] |
Can the object be moved towards a Grabber. Levers, buttons, doorknobs, and other types of objects cannot be moved because they are attached to another object or are static. | |
BNGPlayerController | player [get] |
If a BNGPlayerController is provided we can check for player movements and make certain adjustments to physics. | |
Grabber | FlyingToGrabber [get] |
bool | DidParentHands [get] |
An object that can be picked up by a Grabber.
|
virtual |
|
protected |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Reimplemented in BNG.Climbable.
|
virtual |
|
virtual |
|
virtual |
A BNGPlayerController is optional, but if one is available we can check the last moved time in order to strengthen the physics joint during quick movements. This helps prevent jitter or flying objects in certain situations.
|
virtual |
Get the closest valid grabber.
|
virtual |
ControllerHand BNG.Grabbable.GetControllerHand | ( | Grabber | g | ) |
|
virtual |
Vector3 BNG.Grabbable.GetGrabbersAveragedPosition | ( | ) |
Get the estimated world position of the grabber(s) holding this object. Position factors in 2-Handed grabbing options.
Quaternion BNG.Grabbable.GetGrabbersAveragedRotation | ( | ) |
|
virtual |
|
virtual |
|
virtual |
Transform BNG.Grabbable.GetGrabPoint | ( | ) |
|
virtual |
Returns the Grabber that first grabbed this item. Return null if not being held.
|
protected |
|
protected |
Vector3 BNG.Grabbable.GetVelocityToHitTargetByTime | ( | Vector3 | startPosition, |
Vector3 | targetPosition, | ||
Vector3 | gravityBase, | ||
float | timeToTarget | ||
) |
|
virtual |
Reimplemented in BNG.Climbable.
|
virtual |
|
virtual |
|
virtual |
Is this object able to be grabbed. Does not check for valid Grabbers, only if it isn't being held, is active, etc.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Keep the Grabbable's position and /or rotation in place.
|
virtual |
|
virtual |
|
protected |
|
virtual |
Throw the object by applying velocity.
velocity | How much velocity to apply to the grabbable. Multiplied by ThrowForceMultiplier |
angularVelocity | How much angular velocity to apply to the grabbable. |
|
virtual |
|
virtual |
|
virtual |
Request the Grabbable to use a springy joint for the next X seconds.
seconds | How many seconds to make the Grabbable springy. |
|
virtual |
|
virtual |
|
virtual |
void BNG.Grabbable.ResetParent | ( | ) |
void BNG.Grabbable.ResetScale | ( | ) |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
virtual |
Subscribe to any movement-related events that might cause our Grabbable to suddenly move far away. By subscribing to these events before they occur we can then respond better to these positional updates.
|
virtual |
Allow the Grabbable to move.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
void BNG.Grabbable.UpdateOriginalParent | ( | ) |
void BNG.Grabbable.UpdateOriginalParent | ( | Transform | newOriginalParent | ) |
|
virtual |
|
virtual |
|
virtual |
GrabPoint BNG.Grabbable.ActiveGrabPoint |
Returns the active GrabPoint component if object is held and a GrabPoint has been assigneed.
bool BNG.Grabbable.AddControllerVelocityOnDrop = true |
Set to True to throw the Grabbable by applying the controller velocity to the grabbable on drop. Set False if you don't want the object to be throwable, or want to apply your own force manually.
bool BNG.Grabbable.ApplyCorrectiveForce = true |
bool BNG.Grabbable.BeingHeld = false |
Is this object currently being held by a Grabber.
float BNG.Grabbable.BreakDistance = 0 |
Drop the item if object's center travels this far from the Grabber's Center (in meters). Set to 0 to disable distance break.
bool BNG.Grabbable.CanBeDropped = true |
Set to false to disable dropping. If false, will be permanently attached to whatever grabs this.
bool BNG.Grabbable.CanBeSnappedToSnapZone = true |
Can this object be snapped to snap zones? Set to false if you never want this to be snappable. Further filtering can be done on the SnapZones.
|
protected |
ConfigurableJointMotion BNG.Grabbable.CollisionAngularMotionX = ConfigurableJointMotion.Free |
ConfigurableJointMotion BNG.Grabbable.CollisionAngularMotionY = ConfigurableJointMotion.Free |
ConfigurableJointMotion BNG.Grabbable.CollisionAngularMotionZ = ConfigurableJointMotion.Free |
ConfigurableJointMotion BNG.Grabbable.CollisionLinearMotionX = ConfigurableJointMotion.Free |
ConfigurableJointMotion BNG.Grabbable.CollisionLinearMotionY = ConfigurableJointMotion.Free |
ConfigurableJointMotion BNG.Grabbable.CollisionLinearMotionZ = ConfigurableJointMotion.Free |
List<Collider> BNG.Grabbable.collisions |
float BNG.Grabbable.CollisionSlerp = 500 |
How much Slerp Force to apply to the joint when something is in contact with the grabbable.
float BNG.Grabbable.CollisionSpring = 3000 |
How much Spring Force to apply to the joint when something comes in contact with the grabbable A higher Spring Force will make the Grabbable more rigid.
|
protected |
HandPoseId BNG.Grabbable.CustomHandPose = HandPoseId.Default |
Animator ID of the Hand Pose to use.
|
protected |
|
protected |
float BNG.Grabbable.FlickForce = 1f |
|
protected |
bool BNG.Grabbable.ForceDisableKinematicOnDrop = false |
GrabButton BNG.Grabbable.GrabButton = GrabButton.Inherit |
Configure which button is used to initiate the grab.
GrabType BNG.Grabbable.GrabMechanic = GrabType.Precise |
Snap to a location or grab anywhere on the object.
GrabPhysics BNG.Grabbable.GrabPhysics = GrabPhysics.Velocity |
Kinematic Physics locks the object in place on the hand / grabber. PhysicsJoint allows collisions with the environment.
List<Transform> BNG.Grabbable.GrabPoints |
If Grab Mechanic is set to Snap, the closest GrabPoint will be used. Add a SnapPoint Component to a GrabPoint to specify custom hand poses and rotation.
float BNG.Grabbable.GrabSpeed = 15f |
How fast to Lerp the object to the hand.
HoldType BNG.Grabbable.Grabtype = HoldType.Inherit |
'Inherit' will inherit this setting from the Grabber. 'Hold' requires the user to hold the GrabButton down. 'Toggle' will drop / release the Grabbable on button activation.
HandPoseType BNG.Grabbable.handPoseType = HandPoseType.HandPose |
|
protected |
The grabber that is currently holding us. Null if not being held.
bool BNG.Grabbable.HideHandGraphics = false |
Enabling this will hide the Transform specified in the Grabber's HandGraphics property.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool BNG.Grabbable.InstantMovement = false |
float BNG.Grabbable.LastDropTime |
Time in seconds (Time.time) when we last dropped this item.
float BNG.Grabbable.lastFlickTime |
float BNG.Grabbable.LastGrabTime |
Time in seconds (Time.time) when we last grabbed this item.
|
protected |
Transform BNG.Grabbable.LocalOffsetTransform |
bool BNG.Grabbable.MakeChildCollidersGrabbable = false |
float BNG.Grabbable.MoveAngularVelocityForce = 90f |
float BNG.Grabbable.MoveVelocityForce = 3000f |
|
protected |
Grabbable BNG.Grabbable.OtherGrabbableMustBeGrabbed = null |
The Grabbable can only be grabbed if this grabbable is being held. Example : If you only want a weapon part to be grabbable if the weapon itself is being held.
bool BNG.Grabbable.ParentHandModel = true |
If true, the hand model will be attached to the grabbed object.
bool BNG.Grabbable.ParentToHands = false |
Parent this object to the hands for better stability. Not recommended for child grabbers.
|
protected |
|
protected |
If Grab Mechanic is set to Snap, set position and rotation to this Transform on the primary Grabber.
|
protected |
bool BNG.Grabbable.RemoteGrabbable = false |
Can the object be picked up from far away. Must be within RemoteGrabber Trigger.
|
protected |
float BNG.Grabbable.RemoteGrabDistance = 2f |
Max Distance Object can be Remote Grabbed. Not applicable if RemoteGrabbable is false.
RemoteGrabMovement BNG.Grabbable.RemoteGrabMechanic = RemoteGrabMovement.Linear |
|
protected |
Grabbable BNG.Grabbable.SecondaryGrabbable |
OtherGrabBehavior BNG.Grabbable.SecondaryGrabBehavior = OtherGrabBehavior.None |
What to do if another grabber grabs this while equipped. DualGrab is currently unsupported.
|
protected |
Transform BNG.Grabbable.SecondaryLookAtTransform |
Vector3 BNG.Grabbable.SecondaryLookOffset |
float BNG.Grabbable.SecondHandLookSpeed = 40f |
HandPose BNG.Grabbable.SelectedHandPose |
bool BNG.Grabbable.SnapHandModel = true |
float BNG.Grabbable.ThrowForceMultiplier = 2f |
Multiply controller's velocity times this when throwing.
float BNG.Grabbable.ThrowForceMultiplierAngular = 1.5f |
Multiply controller's angular velocity times this when throwing.
TwoHandedDropMechanic BNG.Grabbable.TwoHandedDropBehavior = TwoHandedDropMechanic.Drop |
TwoHandedLookDirection BNG.Grabbable.TwoHandedLookVector = TwoHandedLookDirection.Horizontal |
TwoHandedPositionType BNG.Grabbable.TwoHandedPosition = TwoHandedPositionType.Lerp |
float BNG.Grabbable.TwoHandedPostionLerpAmount = 0.5f |
TwoHandedRotationType BNG.Grabbable.TwoHandedRotation = TwoHandedRotationType.Slerp |
float BNG.Grabbable.TwoHandedRotationLerpAmount = 0.5f |
bool BNG.Grabbable.UseCustomInspector = true |
Set this to false if you need to see Debug field or don't want to use the custom inspector.
|
protected |
|
protected |
Save whether or not the RigidBody was kinematic on Start.
|
get |
Is this object currently being held by more than one Grabber.
|
get |
Can the object be moved towards a Grabber. Levers, buttons, doorknobs, and other types of objects cannot be moved because they are attached to another object or are static.
|
get |
|
get |
|
get |
|
get |
|
get |
|
get |
|
get |
|
getprotected set |
|
getprotected set |
How many seconds we've gone without collisions.
|
get |
|
getprotected |
If a BNGPlayerController is provided we can check for player movements and make certain adjustments to physics.
|
get |
Have we recently collided with an object.
|
get |
Is the object being pulled towards the Grabber.
|
getprotected set |