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 $$anonymous$$ · Dec 20, 2016 at 06:36 AM · third person controller

Problem with ethan prefab.

I do not know why but sometimes the third person character Ethan gets stuck on edges of things like a cube and floats in place. If I don't touch it for about a minute or two its like the gravity slowly takes over again.

I also cannot for the life of me understand why he wont use stairs. I just downloaded and tried to do the same test with Unity 5.5. Is there something wrong with the settings?

I would really appreciate some help with this.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by CDNexus · Apr 15, 2017 at 04:25 AM

I am sure you have worked out a solution by now. However here is mine for anyone that is stuck on the same issue:

Edit Standard Assets\Characters\ThirdPersonCharacter\Scripts\ThirdPersonCharacter.cs

Add a call to a new method checkClimb() in public void Move(Vector3 move, bool crouch, bool jump):

     ...
     else
     {
         HandleAirborneMovement();
     }

     checkClimb(); // <-- add this

     ScaleCapsuleForCrouching(crouch);
     ...

Then create a method to handle vertical translations based on a ray check that happens from above in front of the character as they move:

         /// <summary>
         /// Work out Y Movement. We may need multiple checks here later too, to prevent us falling into small cracks.
         /// </summary>
         /// <param name="move"></param>
         private void checkClimb()
         {
             float distanceDown = m_offsetVerticalForVerticalChecks + 2.5f;
 
             //float stepOffsetVerticalForHorizontalChecks = 0.1f;
             //float maxOffsetVerticalForHorizontalChecks = 1.5f;
 
             RaycastHit hitInfo;
 #if UNITY_EDITOR
             // helper to visualise the climb check ray in the scene view
             Debug.DrawLine(
                 transform.position + (Vector3.up * m_offsetVerticalForVerticalChecks) + (this.m_ForwardAmount * this.transform.forward * 0.5f), 
                 transform.position + (Vector3.up * m_offsetVerticalForVerticalChecks) + (this.m_ForwardAmount * this.transform.forward * 0.5f) + (Vector3.up * (m_offsetVerticalForVerticalChecks - distanceDown)));
 #endif
             // Actually do the check
             bool collided = Physics.Raycast(
                 transform.position + (Vector3.up * m_offsetVerticalForVerticalChecks) + (this.m_ForwardAmount * this.transform.forward * 0.5f),
                 Vector3.down,
                 out hitInfo,
                 distanceDown);
 
             if (collided && m_offsetVerticalForVerticalChecks + m_maxVerticalFall > hitInfo.distance)
             {
                 if ((m_offsetVerticalForVerticalChecks - hitInfo.distance <= m_maxVerticalClimb) && (m_offsetVerticalForVerticalChecks - hitInfo.distance > 0.0f))
                 {
                     this.transform.Translate(new Vector3(0.0f, m_offsetVerticalForVerticalChecks - hitInfo.distance, 0.0f));
                 }
             }
         }

Comment
Add comment · Show 1 · 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 CDNexus · Apr 15, 2017 at 08:24 AM 0
Share

Also note that this project setting to disable ray checks against triggers was necessary in my case. I am sure there is a way to prevent this check occurring against triggers in the code. Please reply if anyone does work that out.

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

84 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

Related Questions

My character walks slower when looking down? 1 Answer

I has a problem when i pressed "M" key animation not play. I mean amination play but not properly. Animation play properly when i hold "M" key? please help me. I want to play animation on single just click. 0 Answers

opening doors in a third person game 2 Answers

Unitys standard third person controller for multiplayer? 1 Answer

Player teleports when animation finishes 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