(Vive Question) How do I snap a sword to the right position and rotation?
Okay, so I have a game where you can pick up all sorts of objects. This is done by parenting the object to the controller. Simple enough.
I want some objects, like notes, bottles, etc. to be freeform, in that you can grab and rotate them however you like. Other objects, like weapons, should always align to the controller so that the grip of the weapon lines up with the controller so it can be easily used.
The issue I have is that most of my weapon models have a center and/or rotation that doesn't align properly, so simply telling the newly-childed object to align to its parent doesn't work. The obvious solution would be to create a child on the sword that acts as the "grip point," but I have no idea how to get the script to actually use that point as the root. Creating an object and making the sword its child had no effect.
I'm at a loss, here.
I am in this exact same situation. What I did is not perfect but it works... Somewhat. I put an empty gameobject as a child of each controller and positioned it's transform in the desired location. Then on each gameobject that needed to be snapped I put an empty gameobject as a child and adjusted it's rotation to the appropriate rotation. Then in my grab script attached to my controllers I basically set the gameobject's position to the position of the empty gameobject attached to the controller. And then set the gameobjects localEulerAngles to the localEulerAngles of the empty gameobject I added as a child of the gameobject.