07-03-2023 11:42 PM
The problem at hand is that when I grab an object and try to throw it, it behaves unpredictably, sometimes stopping abruptly and other times flying in the opposite direction.
Upon investigation of how it works, the following chain of events can be observed: There is a GrabInteractor that interacts with the GrabInteractable (which can be HandGrabInteractable/ControllerGrab, etc.). Then, the Interactable checks for the presence of a PhysicsGrabbable (a component that applies force upon release). Additionally, there is a VelocityCalculator that calculates the force to be applied.
If the VelocityCalculator is absent, the object will enable its physical properties but will stop since the Velocity is set to 0.
Alright, so we've figured that out. However, the connected calculator is acting strangely and launching in random directions. The issue lies in the linkage. The Interactor passes information about the HandGrabInteractable along the chain instead of the object itself, which may be located at different points. This is because it also handles the visual positioning of the hand (as shown in the photo). But we need it to calculate the object. Fortunately, most of the necessary fields are accessible, and we can refer to the Rigidbody of the interacting object, thereby adding the Rigidbody property to the HandGrabInteractor script:
I have highlighted the added section in the script.
07-10-2023 10:21 AM - edited 07-12-2024 10:55 AM