Using onmousedrag to interact with gameobjects


I’ve been looking around the forum and this q&a section for a solution to my problem but i couldn’t find anything helpful to my issue.

So basically right now I have a player and a sliding door. Currently the door simply slides when the player presses down a button. Instead I would like to have a small animation (player holding the door handle) and then use the mouse as if it were the players arm to open the door.

How would you recommend i’d go about doing it?


Try making the door itself to the animation, and then use an IK controller of some kind to make the hand stick to the handle. There is a decent simple IK controller in the Unity Locomotion System, but it’ll take a bit of work to get it to go nicely with your animations. All in all, there’s no simple one-click solution, but if you’re not afraid of a bit of coding then you can do this using IK solvers in script.