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 ProjectCryken · Aug 09, 2014 at 02:32 PM · physicsrigidbodycontrollerstairssteps

Rigidbody Step Offset

Is there away to replicate the character controller's step offset functionality? At the moment even the smallest obstacle causes my rigidbody to slow drastically.

Please do NOT recommend using a character controller. My project requires the player to be able to walk on walls and the controller's fixed rotation prevents me from using it.

Thanks.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by iuripujol · Oct 24, 2016 at 08:22 AM

There are many ways, one of'em is by using´:

OnCollisionEnter(Collision col){ foreach(ContactPoint cp in col.contacts){ if(cp.thisCollider == YourCollider){ if(cp.y < StepHeight && cp.y > yourCollider.bounds.min.y){ transform.position = Vector3.moveTowards(transform.position, cp.point, Time.deltaTime * yourSpeed); Rigidbody.velocity = transform.up; //ensure your character will step up } } } } //You can also add an angle so the character will only climb the steps which are in his forward direction.

It is very simple and it looks a little bit fake...but the thing is that it works perfectly. *Use Sphere Collider and Capsule Collider instead of using only Capsule Collider.

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

Answer by nesis · Aug 09, 2014 at 03:16 PM

Move your controller, doing a manual check for collisions. If it is grounded from the previous frame and collided with something with a contact point less than stepHeight distance up from your capsule's bottom, move the capsule up so that point is where the capsule's bottom is. You might also want to check the normal of the contacted surface to see if it's walkable. To do that, you can use the dot product of your capsule's transform.up and the surface's normal, or for a more understandable equivalent use Quaternion.Angle() and use Quaternion.LookRotation() to turn the surface normal and your capsule's transform.up into quaternions for use with the Quaternion.Angle() function.

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

Answer by HalversonS · Apr 07, 2016 at 02:00 PM

That's going to be a lot of work. You basically have to rebuild most of this "http://docs.unity3d.com/ScriptReference/CharacterController.html"

If you want to walk on walls and use the character controller you could parent your character to an empty game object. Make sure the parent has the same local values as the object the CC is on, then rotate the parent when you walk on walls. I'm only recommending using a CC (even though you specified you didn't want it) so you don't have to reinvent the wheel.

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

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

25 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

Related Questions

Rigidbody character controller can't walk on stairs 0 Answers

"Swimming" Physics with Rigidbodies 2 Answers

jet pack physics with character controller 1 Answer

Why won't my rigidbody fps controller move? 1 Answer

Character Controller Jittering 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