Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by ozgunn · Oct 24, 2020 at 09:46 AM · rigidbodycapsulecollidercapsulestairs

My capsule character tilts when climbing stairs.

I use capsule as a 3D character on my game and it tilts easily and also it can not climb the stairs. I don't know how to make my capsule character climb stairs without tilting or rolling. (I'm using rigidbody velocity to move my agent.)

 public class karakterkodları : MonoBehaviour
     
     
 {
    
     Rigidbody fizik;
     float horizontal = 0;
     float vertical = 0;
     Vector3 vec;
     public float hiz;
     void Start()
     {
         fizik = GetComponent<Rigidbody>();
 
     }
 
     void FixedUpdate()
     {
         horizontal = Input.GetAxis("Horizontal");
         vertical = Input.GetAxis("Vertical")*-1;
         vec = new Vector3(vertical*hiz, 0, horizontal*hiz);
 
         fizik.velocity = vec;
 
     }
 }
 

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by medyahan · Oct 24, 2020 at 10:41 AM

You can try to open the x, y and z axes from the freeze rotation section in the constraints options on your character's rigidbody. In this way, the rotation of the character will remain constant.

alt text


x.png (3.4 kB)
Comment
Add comment · Show 2 · 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 ozgunn · Oct 24, 2020 at 11:03 AM 0
Share

@medyahan thx for that and I also wonder how can I adjust my character to climb stairs

avatar image medyahan ozgunn · Oct 24, 2020 at 12:48 PM 0
Share

I am glad I could help :) So which component do you use for the player? Character Controller or rigidbody. If you are using rigidbody I suggest you use the character controller. Because you can climb objects like stairs with the step offset value

avatar image
0

Answer by ozgunn · Oct 24, 2020 at 12:57 PM

I appreciate again @medyahan . Last question is how to convert this script for CharacterController component ? Thanks over and over again.

{

 Rigidbody fizik;
 float horizontal = 0;
 float vertical = 0;
 Vector3 vec;
 public float hiz;
 void Start()
 {
     fizik = GetComponent<Rigidbody>();

 }

 void FixedUpdate()
 {
     horizontal = Input.GetAxis("Horizontal");
     vertical = Input.GetAxis("Vertical")*-1;
     vec = new Vector3(vertical*hiz, 0, horizontal*hiz);

     fizik.velocity = vec;

 }

} `

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 medyahan · Oct 24, 2020 at 01:33 PM 0
Share

First Solution: This video will help you to use character controller. Between 2.36 and 9.10 $$anonymous$$utes..

https://www.youtube.com/watch?v=59No0ybIoxg&t=1012s

Second Solution: If you will continue to use Rigidbody, you can try to replace the stairs collider with a sloped collider. But I suggest you use the character controller

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

194 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 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 avatar image avatar image avatar image avatar image

Related Questions

Why can't the Physics Locomotion System walk up stairs/inclines? 2 Answers

Unity 5.0 Physics Freeze rotation not working 5 Answers

When jump my character controller model it goes out of collider 0 Answers

Capsule Collider not moving with the character 0 Answers

Is there a rigidbody character controller 3rd person that can handel stairs (steps)? 1 Answer


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