I’ve been trying to put this asset to use in my project: Head Look Controller
The controller as is uses a targeting system. You attach a script to an object and it makes the characters look at that object. What I want to achieve is having the characters look at a point in space based on where the mouse cursor is. I want to offset that point by (Character.transform.position.z + SkinnedMeshRenderer.bounds.extents.z). I’ve tried doing it the following way but I’m at a loss for what I’m doing wrong.
using UnityEngine;
using System.Collections;
public class Head_Look_Target : MonoBehaviour
{
public HeadLookController headLook;
public SkinnedMeshRenderer skinnedRenderer;
private float offset = 1.0f;
void LateUpdate()
{
offset = transform.position.z + skinnedRenderer.bounds.extents.z;
Vector3 target = Input.mousePosition;
target.z = offset;
headLook.target = target;
}
}