How to make DOOR ANIMATION [Unity 2020]
ฝัง
- เผยแพร่เมื่อ 22 ก.ย. 2024
- Hey everyone, welcome to my video.
Don't forget to subscribe;
➤ bit.ly/3it8kVV
In this video we'll see how to animate the door? How do we interact with it? I quickly answer questions such as how do we make the opening and closing sounds of the door.
GitHub link of the project;
➤ ay.link/prdoor
Download the code;
➤ ay.link/doorsc
This is really simple and easy to do. Plus it can make your game more fun and realistic!
#door #unity #animation
Abone olmayı unutmayın;
➤ bit.ly/3it8kVV
Merhaba kodu başka bir yoldan iletebilir misiniz benim İnternet hizmetimde site güvenilmez uyarısı veriyor ve giriş yapamıyorum
Pivot noktası nasıl ayarlanıyor
Eline sağlık, çok güzel olmuş.
Github linki çalışmıyor ne yapmalıyım ?
Açılıp kapanma hızını nasıl azaltabiliriz çok hızlı açılıp kapanıyor da
Animasyonun keyframe lerinin aralığını daha da uzatarak ya da animatorde o animasyonu seçip speedini yavaşlatabilirsin.
@@CanMujde Yaptım abi teşekkür ederim
Merhaba kodu başka bir yoldan iletebilir misiniz benim İnternet hizmetimde site güvenilmez uyarısı veriyor ve giriş yapamıyorum
using TMPro;
using UnityEngine;
public class Door : MonoBehaviour { public AudioClip open, close;
public AudioSource source;
public Animator animator;
public TextMeshProUGUI[] info;
public bool canInteract;
public bool isOpen;
void Start()
{
animator = GetComponent();
}
private void OnTriggerStay(Collider other)
{
if (!other.CompareTag("Player")) return;
canInteract = true;
}
private void OnTriggerExit(Collider other)
{
if (!other.CompareTag("Player")) return;
canInteract = false;
}
private void Update()
{
foreach (TextMeshProUGUI text in info)
{
text.gameObject.SetActive(canInteract);
text.text = isOpen ? "\"F\" kapat" : "\"F\" aç";
}
if (!Input.GetKeyDown(KeyCode.F)) return;
if (!canInteract) return;
if (!isOpen)
{
animator.SetTrigger("Open");
source.clip = open;
source.Play();
}
else if (isOpen)
{
animator.SetTrigger("Close");
source.clip = close;
source.Play();
}
isOpen = !isOpen;
}
}
using TMPro;
using UnityEngine;
public class Door : MonoBehaviour { public AudioClip open, close;
public AudioSource source;
public Animator animator;
public TextMeshProUGUI[] info;
public bool canInteract;
public bool isOpen;
void Start()
{
animator = GetComponent();
}
private void OnTriggerStay(Collider other)
{
if (!other.CompareTag("Player")) return;
canInteract = true;
}
private void OnTriggerExit(Collider other)
{
if (!other.CompareTag("Player")) return;
canInteract = false;
}
private void Update()
{
foreach (TextMeshProUGUI text in info)
{
text.gameObject.SetActive(canInteract);
text.text = isOpen ? "\"F\" kapat" : "\"F\" aç";
}
if (!Input.GetKeyDown(KeyCode.F)) return;
if (!canInteract) return;
if (!isOpen)
{
animator.SetTrigger("Open");
source.clip = open;
source.Play();
}
else if (isOpen)
{
animator.SetTrigger("Close");
source.clip = close;
source.Play();
}
isOpen = !isOpen;
}
}
@@ercaneyup57 Teşekkür ederim.
@@ameleustv3093 önemli değil ama oluşturduğun c++ dosyasının adını Door yapmazsan kod çalışmaz
@@ercaneyup57 Tamam anladım tekrardan teşekkür en yakın zamanda kodu uygulayacağım.
yarım anlatmıs