Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
jaumet2000's avatar
jaumet2000
Honored Guest
4 years ago
Solved

Check if an object is grabbed

 Hello guys. I can't find a way to check if an object is grabbed or not,  a boolean that is true if it is grabbed and false if it is not. The attached image is the components that the object that I w...
  • WolffRuoff's avatar
    4 years ago

    There might be an easier solution but when I did this, I also wanted a few other features so I created my own ITransformer and put it in the Grabbable Script. Once you do this, you can just copy-paste the code in the default ITransformer you want. In an ITransformer, there is a method called BeginTransform() that is called when an object is first grabbed and EndTransform() when it is unselected. I'd recommend saving a bool somewhere else that is changed by these methods.

     

    EDIT: If you want to get the gameobject inside the iTransformer script use this (assuming the script is on the gameobject): 

    _grabbable.Transform.gameObject