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 tuta100 · Sep 17, 2015 at 04:45 PM · rotationphysicsgravitycollidersplatformer

how would I make a capsule rotate and go down a platform on the y axis?

Hi I am creating a 3d platform game , I am currently trying to make a capsule rotate to a 90 degree angle and walk down the platform? Im not sure how to start with coding this. I have added a box collider to the platform on the y-axis, and the capsule has a rigidbody with a gravity of true. I don't know wether I am suppose to set the gravity to false, and set the box collider to is trigger on and as the "player" hits the collider, the gravity changes? I have looked at everything online and nothing seemed to be working with me... Could someone please please help me.

alt text

screen-shot-2015-09-15-at-15715-pm.png (75.8 kB)
Comment
Add comment · Show 4
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 Cherno · Sep 17, 2015 at 05:09 PM 0
Share

Cast a ray downwards (in the capsule's local space) and rotate the capsule towards the hit.normal vector3.

RaycastHit.normal

avatar image Glurth Cherno · Sep 17, 2015 at 07:47 PM 0
Share

While that might work for sloped terrain, I don't think it will work for the horizontal->vertical->horizontal example in the OP's picture: it would just drop to the bottom of the cliff. Perhaps getting the nearest terrain point using a spherecast might work better? (I'm assu$$anonymous$$g we want it to walk down the wall like an ant would, is that correct tuta?)

avatar image Cherno Glurth · Sep 17, 2015 at 08:04 PM 0
Share

You are right. However, the problem that sheer cliffs might cause can be cicumvented by checking for a hit below a certain threshold, and if nothing is hit, two more rays are cast, with diagonal forward-downwards and diagonal backward-downward vectors.

avatar image tuta100 · Sep 18, 2015 at 12:19 AM 0
Share

Yes exactly like an ant. Ok I kind of understand what you mean, and will give it a go thanksss.

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How can I bind this script into the state of my camera? 2 Answers

Changing gravity depending on character/camera rotation 0 Answers

How to change physics properly? 0 Answers

Can 'position squishing' be prevented when using Rigidbody.movePosition()? 0 Answers

Will too many colliders affect game performance? 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