Question by
awsedrftawse · Nov 29, 2019 at 09:00 AM ·
movement
Somersault kick does not work
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player_Somersault : MonoBehaviour
{
public bool SaultDelay = false;
public float Power = 30f;
private Animator Anim;
private Rigidbody Rbody;
void Start()
{
Rbody = GetComponent<Rigidbody>();
Anim = GetComponent<Animator>();
}
void Update()
{
if (Input.GetKeyDown(KeyCode.A) && !SaultDelay)
{
Anim.Play("Player_Somersault");
if (transform.rotation == Quaternion.Euler(0, 90, 0))
{
Rbody.AddForce(new Vector3(-Power, Power, 0), ForceMode.Impulse);
}
else
{
Rbody.AddForce(new Vector3(Power, Power, 0), ForceMode.Impulse);
}
SaultDelay = true;
}
if (Input.GetKeyDown(KeyCode.R))
{
SaultDelay = false;
}
}
}
I want diagonal jump(both x and y) when press A key, but it just jump only y axis. help me plz..
Comment