Forum Discussion
tbkuno
8 years agoExplorer
OVRGrabber stops working
Hi everyone,
I'm building a prototype with around 150-200 grabbable objects for a test. When throwing an object and if the collision with the ground or other objects is strong enough, the thrown object will instantiate a shattered prefab version of itself upon impact (with mesh colliders and rigidbodies) for creating the illusion that the object has broken.
After throwing a lot of objects around and instanciating lots of shards at some point I cannot grab anymore objects and there's an error in the console for the OVRGrabber script:
NullReferenceException: Object reference not set to an instance of an
object OVRGrabber.MoveGrabbedObject (Vector3 pos, Quaternion rot,
Boolean forceTeleport) (at Assets/OVR/Scripts/Util/OVRGrabber.cs:321)
Does anybody know how to fix this issue?
I'm building a prototype with around 150-200 grabbable objects for a test. When throwing an object and if the collision with the ground or other objects is strong enough, the thrown object will instantiate a shattered prefab version of itself upon impact (with mesh colliders and rigidbodies) for creating the illusion that the object has broken.
After throwing a lot of objects around and instanciating lots of shards at some point I cannot grab anymore objects and there's an error in the console for the OVRGrabber script:
NullReferenceException: Object reference not set to an instance of an
object OVRGrabber.MoveGrabbedObject (Vector3 pos, Quaternion rot,
Boolean forceTeleport) (at Assets/OVR/Scripts/Util/OVRGrabber.cs:321)
Does anybody know how to fix this issue?
7 Replies
Replies have been turned off for this discussion
- tbkunoExplorerI probably won't be using some many objects, just testing out whether it could work. I'm going to look for another alternative, thanks!
- kailashgajaraHonored GuestMy issue is same. I have applied mesh collider and can not grab the object any more. Any pointers?
- tbkunoExplorer
kailashgajara said:
My issue is same. I have applied mesh collider and can not grab the object any more. Any pointers?I realized the problem was on my side.While instantiating the shattered object, the original object was being destroyed. Apparently with so many objects, at some point an object was being destroyed before it could leave the hand so OVRGrabber wouldn't register the object from leaving and it couldn't grab anymore although the object wasn't there anymore.What I did was I translated the objects to another place outside the level environment, and then after some time I would destroy them, so the hand would definitely register the objects leaving. - CDawesProtege
Hi tbkuno Could you tell me how you managed to implement this fix? I'm having the same issue, but new to unity and C#.
I also tried teleporting the object to a different location and then destroying it while it is still grabbed, which helps 90% of the time. When you say you destroyed them after some time, did you tell the OVR grabber to release the object in a script? As when I transform the location, my object loops between the new position and old one as the object is still grabbed.
I want my object to be destroyed when it enters a collider (inserting a coin into a machine).
Any help is appreciated 🙂
- tbkunoExplorer
Hi, if I recall correctly I didn't have to tell OVR grabber that the object had moved, since I had to let go the grab button after having it thrown, I guess it recognized that the object wasn't there anymore. So after you ungrab the object it shouldn't loop between positions. A dirty fix in your case would be maybe just to turn off the coin's mesh renderer and collider after insterting it into the machine.
- CDawesProtege
Thanks for the reply and your help - with it was able to create a fix by telling the OVR grabber to drop the object before its destroyed. It seemed without using ForceRelease() that the grabber doesn’t remove the references to the old grabbed object, and as they are not destroyed throws a null exception error. I'll post it here in case others may find it useful.
public class arcadeCoinManagement : MonoBehaviour
{
public OVRGrabber myOVRGrabberLeft
public OVRGrabber myOVRGrabberRight;public void OnTriggerEnter(Collider other) {
myOVRGrabberLeft.GetComponent<OVRGrabber>().ForceRelease(myOVRGrabberLeft.grabbedObject); myOVRGrabberRight.GetComponent<OVRGrabber>().ForceRelease(myOVRGrabberRight.grabbedObject);}
- Slugg3r18Honored Guest
Had the exact same issue. I think the OVRGrabbable OnDestroy() function should run when the item is destroyed and do the ForceRelease() function but it does not appear to be working for some reason. Running it manually before destroying the object fixed this.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 years ago
- 3 years ago
- 4 months agoAnonymous