Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Rembo4Fight · Aug 26, 2016 at 10:57 PM · animation2dscripting problemanimatorfixedupdate

HELP,Watched tutorial https://www.youtube.com/watch?v=Xnyb2f6Qqzg

alt textalt textI 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;

 }

}

screen-shot-2016-08-27-at-015805-copy.jpg (298.5 kB)
screen-shot-2016-08-27-at-021008-copy.jpg (228.2 kB)
Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DavidWatts · Aug 27, 2016 at 12:18 AM 0
Share

do you have a rigidbody2D attached to the player?

avatar image Rembo4Fight DavidWatts · Aug 27, 2016 at 12:20 AM 0
Share

yes , sure

avatar image DavidWatts Rembo4Fight · Aug 27, 2016 at 12:25 AM 0
Share

and an animator?

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by DavidWatts · Aug 27, 2016 at 12:42 AM

you forgot to set ground check in the inspector

Comment
Add comment · Show 10 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Rembo4Fight · Aug 27, 2016 at 12:55 AM 0
Share

no,I am not forgot to do that alt text

screen-shot-2016-08-27-at-033506-copy.jpg (41.4 kB)
avatar image DavidWatts Rembo4Fight · Aug 27, 2016 at 12:59 AM 0
Share

http://answers.unity3d.com/storage/attachments/76986-screen-shot-2016-08-27-at-021008-copy.jpg

avatar image Rembo4Fight DavidWatts · Aug 27, 2016 at 01:02 AM 0
Share

it was the old picture, i will replace it)

Show more comments
Show more comments
avatar image DavidWatts Rembo4Fight · Aug 27, 2016 at 01:12 AM 0
Share

that is strange is there any script attached to ground check

avatar image Rembo4Fight DavidWatts · Aug 27, 2016 at 01:22 AM 0
Share

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 probalt textlem

screen-shot-2016-08-27-at-041934-copy.jpg (233.1 kB)
Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

95 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How can i stop my shooting animation after playing? 0 Answers

How to check if animation is playing in a Blend Tree? 1 Answer

Animation Legacy behavior -> Mecanim animation 1 Answer

Animating Sprites Through Separate Script? 0 Answers

How to modify animator transition conditions via script 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges