HELP,Watched tutorial https://www.youtube.com/watch?v=Xnyb2f6Qqzg
I watched the tutorial live training for 2d character controller https://www.youtube.com/watch?v=Xnyb2f6Qqzg And i have troubles with vspeed It had stuck every time when i jump in 6 number My charater have Apply Root Motion Update Mode : normal Culling Mode : Always Animate
I am adding the video to help you understand what i mean)
https://www.youtube.com/watch?v=6ZzYMI6632U
using UnityEngine; using System.Collections;
public class PlayerControllerScript : MonoBehaviour { public float maxSpeed = 10f; bool facingRight = true;
Animator Anim;
bool grounded = false;
public Transform groundCheck;
float groundRadius = 0.2f;
public LayerMask whatIsGround;
public float jumpForce = 125f;
void Start () {
Anim = GetComponent<Animator> ();
}
void FixedUpdate ()
{
grounded = Physics2D.OverlapCircle (groundCheck.position, groundRadius, whatIsGround);
Anim.SetBool ("Ground", grounded);
Anim.SetFloat ("vSpeed", GetComponent<Rigidbody2D>().velocity.y);
float move = Input.GetAxis ("Horizontal");
Anim.SetFloat ("Speed", Mathf.Abs (move));
GetComponent<Rigidbody2D>().velocity = new Vector2 (move * maxSpeed, GetComponent<Rigidbody2D>().velocity.y);
if (move > 0 &&!facingRight)
Flip ();
else if (move < 0 && facingRight)
Flip ();
}
void Update()
{
if(grounded && Input.GetKey ("space"))
{
Anim.SetBool("Ground", false);
GetComponent<Rigidbody2D>().AddForce(new Vector2(0, jumpForce));
}
}
void Flip()
{
facingRight = !facingRight;
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}
}
Answer by DavidWatts · Aug 27, 2016 at 12:42 AM
you forgot to set ground check in the inspector
no,I am not forgot to do that
that is strange is there any script attached to ground check
groundCheck is "checked ;)" now i have only problem with vspeed it very laggy like you can see from video in discription and this is my picture to this problem