- Home /
Blend Tree Idle3D
Hey everyone I am trying to make a game. I have a blend tree which allows player to run with a joystick but with blend tree I cannot Idle my charater prbably because of joystick property. Any way it is necessary to disable animation when there is no movement. I tried it by a speed value but it didnte work. It is my codes:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour {
joystick griliVAl;
Animator animasyon;
// Use this for initialization
void Start () {
animasyon = GetComponent<Animator>();
griliVAl = GameObject.FindGameObjectWithTag("Joystick").GetComponent<joystick>();
}
// Update is called once per frame
void Update () {
float x = griliVAl.griliv.x;
float y = griliVAl.griliv.y;
animasyon.SetFloat("Valx", x);
animasyon.SetFloat("Valy", y);
Quaternion targetRotation = Quaternion.LookRotation(griliVAl.griliv*5);
transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, Time.deltaTime);
transform.position += griliVAl.griliv * 5 * Time.deltaTime;
}
}
I tried to ve float speed value and then with a if condition to do but it didnt work. I can use animayon.enable = false
but I cannot. Can you please help ?
Answer by unity_bTkJGG31azdikQ · Aug 28, 2020 at 07:52 PM
I think you want to use states in the Animator Controller, not blend trees. Hope that helps.
Your answer
Follow this Question
Related Questions
blend tree animation stuck on one frame 1 Answer
Custom Animation for Avatar with Standard Assets and Blend Tree 0 Answers
3d animation controller 0 Answers
Sprites: Project Sprite to Mesh, allow for bending of sprites for 3d environments 0 Answers
(video) Exporting a Blender FBX to Unity only brings one animation into Unity 1 Answer