- Home /
IK control following the mouse cursor
Hello,
I have an animation used on video best practices of Unity, and I wonder if I can make a control "IK" follow my cursor during the game (something like Transform.LookAt)
The animation in question does not have any script was all done in the animation window ... I confess I've searched about it and not find what I needed and did not know where to start.
In short, it would make the arm of my character following the mouse cursor.
Watch the video of how it would be:
Not in the video is a simulation of how it should be !
Answer by IgorUnity3D · Mar 11, 2015 at 09:23 AM
I managed to fix it easily by adding the following script in my control IK :
using UnityEngine;
using System.Collections;
public class ArmRotation : MonoBehaviour {
// Update is called once per frame
void Update () {
var pos = new Vector3(Input.mousePosition.x,Input.mousePosition.y,0);
pos = Camera.main.ScreenToWorldPoint(pos);
transform.position = pos;
}
}
Your answer
Follow this Question
Related Questions
How do I use the IKsystem to make a humanoid's arms move with the Camera? 0 Answers
mouse look player controller and locomotions with if then else?? 1 Answer
mouse look not looking up and down when I add unet network manager 0 Answers
Mouse should Check Collison of object and change its color 1 Answer
mouse movement 0 Answers