Animación 2D atascada en animación de salto
– UnityAssets3Free
hola , soy jorge y para hoy os traigo
esta unity pregunta
Estaba viendo un viejo video de brackeys sobre cómo hacer animación 2D y estoy seguro de que seguí todo en el tutorial correctamente. Todo iba bien hasta que comencé la animación de salto. La animación de salto no se detendrá durante la función de aterrizaje. el video esta aqui https://www.youtube.com/watch?v=hkaysu1Z-N8&feature=emb_logo y mi codigo es este:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
public CharacterController2D controller;
public float runSpeed = 80f;
float horiztalMove = 0f;
bool jump = false;
public Animator animator;
// Start is called before the first frame update
// Update is called once per frame
void Update()
horiztalMove = Input.GetAxisRaw("Horizontal") * runSpeed;
animator.SetFloat("Speed", Mathf.Abs(horiztalMove));
if (Input.GetButtonDown("Jump"))
jump = true;
animator.SetBool("Jumping", true);
public void OnLanding ()
animator.SetBool("Jumping", false);
void FixedUpdate()
//move our character
controller.Move(horiztalMove * Time.fixedDeltaTime, false, jump);
jump = false;
Si hay algún otro código o capturas de pantalla que quieras que te envíe, lo haré.
1 respuesta 1
En esta línea, no ha agregado el «».
if (Input.GetButtonDown("Jump"))
jump = true;
animator.SetBool("Jumping", true);
Escribe esto en su lugar:
if (Input.GetButtonDown("Jump")
jump = true;
animator.SetBool("Jumping", true);
Y vi el video de Brackeys que usaste… Y mi pregunta es, ¿agregaste el script PlayerMovement al evento On Land de CharacterController y seleccionaste la función OnLanding() que hiciste en el script PlayerMovement?
Intente verificar si agregó OnLanding() y también corrija el en la línea que te indiqué. Espero terminar siendo útil para usted. <3
nota: si aun no se resuelve tu pregunta por favor dejar un comentario y pronto lo podremos de nuevo , muchas gracias
sin mas,espero que te halla servido