Horje
unity move character with animation Code Example
unity move character with animation
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{

    public CharacterController controller;
    public Animator animator;

    public float speed = 6f;

    // Start is called before the first frame update
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
    }

    // Update is called once per frame
    void Update()
    {
        Vector3 moveForwards = new Vector3(0f, 0f, 1f);
        Vector3 Stop = new Vector3(0f, 0f, 0f);

        if (Input.GetKey(KeyCode.W))
        {
            animator.SetInteger("Condition", 1);

            controller.Move(moveForwards * speed * Time.deltaTime);
        }

        if (Input.GetKeyUp(KeyCode.W))
        {
            animator.SetInteger("Condition", 0);

            controller.Move(Stop);
        }
    }
}




Csharp

Related
multithreading in .net core Code Example multithreading in .net core Code Example
change true to false unity Code Example change true to false unity Code Example
c# arraylist to listview Code Example c# arraylist to listview Code Example
c# code process to start any exe application Code Example c# code process to start any exe application Code Example
how to add colider in obj in unity 2020 Code Example how to add colider in obj in unity 2020 Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11