VR Interaction Framework v2.0
No Matches
BNG.Climbable Class Reference

Allows the Player to climb objects by Grabbing them. More...

Inheritance diagram for BNG.Climbable:

Public Member Functions

override void GrabItem (Grabber grabbedBy)
override void DropItem (Grabber droppedBy)
- Public Member Functions inherited from BNG.Grabbable
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.

Additional Inherited Members

- Public Attributes inherited from BNG.Grabbable
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 inherited from BNG.Grabbable
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 inherited from BNG.Grabbable
List< GrabberheldByGrabbers
 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< GrabbableEventsevents
bool didParentHands = false
- Properties inherited from BNG.Grabbable
bool BeingHeldWithTwoHands [get]
 Is this object currently being held by more than one Grabber.
List< GrabberHeldByGrabbers [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]

Detailed Description

Allows the Player to climb objects by Grabbing them.

Member Function Documentation

◆ DropItem()

override void BNG.Climbable.DropItem ( Grabber  droppedBy)

Reimplemented from BNG.Grabbable.

◆ GrabItem()

override void BNG.Climbable.GrabItem ( Grabber  grabbedBy)

Reimplemented from BNG.Grabbable.

The documentation for this class was generated from the following file: