SO i have try make script with can put something on player hand. But not working.
and i put this code Axe object.
Here’s my try:
using UnityEngine;
using System.Collections;
public class TakeAxe : MonoBehaviour {
public Transform player;
public bool have_axe = false;
public bool enter = false;
void Update (){
if(have_axe == true){
transform.position = Vector3(player.transform.position.x, player.transform.position.y, player.transform.position.z);
}
if(have_axe == false){
}
if(have_axe == true){
if(Input.GetKeyDown("f")){
have_axe = !have_axe;
}
}
}
void OnTriggerEnter (Collider other){
if (other.gameObject.tag == "Player") {
(enter) = true;
}
}
void OnTriggerExit (Collider other){
if (other.gameObject.tag == "Player") {
(enter) = false;
}
}
}