samet36
Hectopat
- Katılım
- 1 Ağustos 2022
- Mesajlar
- 720
Daha fazla
- Cinsiyet
- Erkek
Yapacağım oyundaki karakterin animasyon ekledim. Bir Idle animasyonu var bir de "W" basıldığında koştuğu bir animasyonu var. "W" bastığımda Idle animasyonuyla hareket ediyor. Bir süre sonra koşma animasyonuna geçiyor. Bunu "W" bastığımda hemen koşma animasyonun girilmesini nasıl sağlarım?
C#:
Using System. Collections;
Using System. Collections. Generic;
Using unityengine;
Public class hareketanimasyon: Monobehaviour.
{
Float Speed = 0.25F;
Float rotspeed = 80;
Float gravity = 8;
Float rot = 0;
Vector3 movedir = Vector3.Zero;
Charactercontroller kontrol;
Animator anim;
Void Start()
{
Kontrol = GetComponent<CharacterController>();
Anim = GetComponent<Animator>();
}
Void Update()
{
İf(kontrol. İsgrounded)
{
İf (ınput. Getkey(keycode. W))
{
Movedir = New Vector3(0, 0, 1);
Movedir *= Speed;
Anim. Setınteger("hareket", 1);
Movedir = transform. Transformdirection(movedir);
}
Else {
Movedir = New Vector3(0, 0, 0);
Anim. Setınteger("hareket", 0);
}
}
}
}
Son düzenleyen: Moderatör: