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
5
Question by Pilot · Feb 23, 2012 at 08:10 AM · rigidbodylocomotioncapsulestairslocomotion system

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

I am having a lot of trouble getting the Planet Scene, Physics/rigidbody Locomotion System character (Hero), to climb a primitive set of stairs. The problem seems to be the capsule collider getting caught on each step and the permanent gravity force pushing down. I am using a clean, new copy of the Planet scene from the Locomotion Demo, and for the stairs I have simply arranged several cubes together.

The character will struggle to climb the first two steps, and after that will not go any higher unless jumping. I am after getting behaviour like in the Crate Climb demo, but with a rigidbody driven character (not character controller), is this possible?

The things I have tried:

  • Adjusting the Max Step height, Max slope angle and the Tilt Amounts

  • Raising the bottom of the capsule collider

  • Copying the Leg Animator settings from the Crate Climb scene

  • Turning off Centric Gravity

  • Testing with a ramp

  • Writing a new rigidbody motor (uses a raycast to tell if grounded)

  • Writing a second rigidbody motor (uses OnCollisionEnter to tell if grounded)

If I use the same Stairs prefab in the Crate Climb scene the character has no problems getting to the top. Surely you're not restricted to just the CC for climbing elevated surfaces. Has anybody else experienced similar troubles with the Physics Locomotion System like this? Please let me know how to resolve this, as I plan to use the same setup for my own character.


Planet Scene - Using Capsule Collider:

alt text

Crate Climbing Scene - Using Character Controller:

alt text

Ramp Test - Same incline as stairs

alt text

SOLVED - See the inspector for the settings

alt text

[1]: http://i44.photobucket.com/albums/f7/whoopiecushion55/PhysicsStairs.jpg

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
3
Best Answer

Answer by Hamesh81 · Feb 25, 2012 at 03:53 PM

Seriously, I would rewrite/make your own motor. I remember testing the Locomotion System's physics motor back in the day and it was quite a terrible system for anything other than using centric gravity. Very impractical for any movement over non-flat surfaces, which seems kinda ironic actually. If you don't wanna write a motor script from scratch try changing the way gravity is handled. For example, only apply gravity when the character is not grounded. Also, try making the capsule radius wider which will make the bottom rounder and less likely to get caught on your steps.

The main problem you're having is that the forward force (when walking, running etc) is competing with the gravity force whenever there is any sort of incline. Meaning if the force driving your character forward is less than the gravity force pulling it down, it can never generate enough speed to climb the surface. You could see this when you turned off gravity and it had no problems climbing. Another test you could do is set gravity to 0.1, walk up your steps and when you get stuck try holding shift to start running, it should start climbing. This is because the added boost from the run is enough to over power the weaker gravity force. Anyway, see how you go.

Comment
Add comment · Show 4 · 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 Pilot · Feb 26, 2012 at 07:24 PM 0
Share

Thank you for your advice. I wrote a new rigidbody motor script (see in the question above) and it definitely solved the gravity issue. Unfortunately that is only part of the problem. The other problem is the raycast and its position relative to the character's feet. Since when climbing up the stairs the feet are positioned in front of the capsule collider and the ray being cast, the ray and capsule are always about one step behind the feet and therefor give inaccurate results. You can clearly see this in the diagrams above.

In all honesty it feels like this system is quite broken. I don't want to sound negative but there is very little to no documentation about the physics setup, and considering it is an official Unity resource, making even the most $$anonymous$$imal of changes shouldn't be such laborious task. Not really sure where to go from here.

avatar image Hamesh81 · Feb 26, 2012 at 08:02 PM 0
Share

Don't know about 'broken', but there defs isn't much info about setting up a rigidbody based locomotion system. Like I said, I didn't find it particularly useful for uneven surfaces and ended up making my own system from scratch. You probably don't want to hear this, but there could be a better way for doing the motor script you tried above. Try giving these two a try first and if you still have problems let me know:

http://www.unifycommunity.com/wiki/index.php?title=PhysicsFPSWalker

http://www.unifycommunity.com/wiki/index.php?title=RigidbodyFPSWalker

avatar image Pilot · Feb 27, 2012 at 07:30 AM 1
Share

After extensive testing and modifying I have finally managed to SOLVE this. So glad it is over, at least this part anyway :)

You were right, it was the motor (or rather the raycast it was using) that was causing the final problem. Using OnCollisionEnter works perfectly now. Thank you so much for your help @Hamesh81, really glad you saw my question.

avatar image Hamesh81 · Feb 27, 2012 at 11:04 AM 0
Share

Glad you figured it out! A rigidbody setup is a bit harder than a CC setup intially imo, but once everything falls in place it is much more flexible and easier to do awesome things with. Good luck with the rest of it.

avatar image
1

Answer by junaum · Feb 23, 2012 at 04:23 PM

Try reducing the radius of the capsule collider and increasing the depth of each stair step (make each step farther from each other). It seems that the capsule is touching the current stair step AND the next one, in the same time, causing it to think you are on a really steep cliff.

Comment
Add comment · Show 5 · 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 Pilot · Feb 24, 2012 at 06:00 AM 0
Share

Thank you for your advice. I made the capsule collider a lot thinner, however this is still causing problems. I've added two images in the question, comparing the physics system and the character controller. The depth of the stairs should not matter so much since the character controller can climb the same stairs without a problem (once it's slope limit is raised). If there were a slope limit setting on the capsule collider I think this would solve the problem. What are your thoughts?

avatar image junaum · Feb 24, 2012 at 11:20 AM 0
Share

The depth of the stairs (horizontal distance between each stair step) might indeed mean something on this case (if the capsule can climb an slope equivalent to your stair step, then the problem is just the fact that the capsule is being forced to deal with 2 steps in the same time, because they are too close to each other).

avatar image Pilot · Feb 24, 2012 at 12:52 PM 0
Share

Sure, I understand what you mean. It just seams a little strange that the Capsule Collider can't walk up the same incline that the Character Controller has no trouble with. I realize they handle the incline a little differently, but they're both still using the Locomotion System.

I tested what you suggested and placed a ramp with the same incline as the stairs (an image of the result is in the question above). The ramp seems to be causing the same problems that the stairs had. Could it be something to do with the gravity being applied to the Rigidbody? Since in the Crate Climb example that Character Controller has no gravity applied to it. Other than that the only difference between the two setups I can see is that the Character Controller is higher of the ground than the Capsule Collider.

avatar image UnityDeveloper99 · Feb 24, 2012 at 02:37 PM 0
Share

Looks to me like an issue with the height of the capsule collider. In the crate example the CC is positioned a bit above the feet, which allows the character to 'glide' more easily over the steps as the locomotion system climbs its way up. The capsule collider is right on the ground which means the steps are higher and harder for it to climb. Raise the capsule up a bit.

avatar image Pilot · Feb 24, 2012 at 04:56 PM 0
Share

The capsule collider can't be raised because it is held down by gravity, so when simulating the game it will drop to the ground no matter how high it is positioned before hand. I have managed to climb the ramp by turning off gravity, but that isn't a very good solution. Surely there's a way to do this, isn't the purpose of the locomotion system to walk on uneven surfaces? Or should I be looking for an alternative system if using a physics based character? Any advice welcome :)

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

8 People are following this question.

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

Related Questions

My capsule character tilts when climbing stairs. 2 Answers

Swining Arm Locomotion 0 Answers

Adding falling and landing animations to the Locomotion System 1 Answer

Issue w/ Difference between Cube and Capsule 0 Answers

Physics.Raycast not working as expected! 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