Provides a base that all joint based grab attach mechanics can inherit from.
This is an abstract class that is to be inherited to a concrete class that provides joint based grab attach functionality, therefore this script should not be directly used.
- Destroy Immediately On Throw: Determines whether the joint should be destroyed immediately on release or whether to wait till the end of the frame before being destroyed.
public override bool ValidGrab(Rigidbody checkAttachPoint)
Rigidbody checkAttachPoint- The rigidbody attach point to check.
trueif there is no current grab happening, or the grab is initiated by another grabbing object.
The ValidGrab method determines if the grab attempt is valid.
public override bool StartGrab(GameObject grabbingObject, GameObject givenGrabbedObject, Rigidbody givenControllerAttachPoint)
GameObject grabbingObject- The GameObject that is doing the grabbing.
GameObject givenGrabbedObject- The GameObject that is being grabbed.
Rigidbody givenControllerAttachPoint- The point on the grabbing object that the grabbed object should be attached to after grab occurs.
trueif the grab is successful,
falseif the grab is unsuccessful.
The StartGrab method sets up the grab attach mechanic as soon as an Interactable Object is grabbed. It is also responsible for creating the joint on the grabbed object.
public override void StopGrab(bool applyGrabbingObjectVelocity)
bool applyGrabbingObjectVelocity- If
truewill apply the current velocity of the grabbing object to the grabbed object on release.
The StopGrab method ends the grab of the current Interactable Object and cleans up the state. It is also responsible for removing the joint from the grabbed object.
Updated less than a minute ago