Click the object to handheld
make sure your imported mixamo character the animation type is humanoid
add collider to your item
add tag to your item "Selectable" case sensitive please aware
drag and drop the hand location to your items
using Unity.VisualScripting;
using UnityEngine;
public class ObjectSelector : MonoBehaviour
{
public Transform handHeld;
void Update()
{
// Detect mouse click
if (Input.GetMouseButtonDown(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
// Raycast from the mouse position
if (Physics.Raycast(ray, out RaycastHit hit))
{
// Optional: check for tag
if (hit.collider.CompareTag("Selectable"))
{
Debug.Log("Selected object: " + hit.collider.name);
GameObject holdItem = Instantiate(gameObject, handHeld);
holdItem.transform.localPosition = Vector3.zero;
Destroy(gameObject);
}
}
}
}
}