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 ddule · Oct 07, 2021 at 11:49 AM · 3dplatformercharacter controller

Troubles making custom 3D character controller (for platformer)

My main goal is creating a 3D platformer.

By using Unity's character controller I had troubles implementing features like moving platforms and rotating platforms which needs to move/push and rotate players in expected way. I was not satisfied with the attemps I made with the Unity's character controller so I've decided to make my own.

So I'm basically not asking how to implement specific thing , just am I at the right way.

So , when I was developing the custom character controller I found out that you can't manually check collisions and get Collision data in regular way. I found the only options were functions like Physics.OverlapCapsule which returns the Colliders (which are objects) with which the virtual capsule has collided. One of the problems which has occured is that I cannot get the Collision point which I need to check is the platform ground or ceiling, if it is ground I move player upwards otherwise downwards.

So my questions are next:
1. Am I too optimistic with creating custom character controller (Is it a good idea).
2. Am I creating the custom character controller the right way (with overlapcapsule)
3. And if it isn't a good idea what is the better way to implement 3D platformer and moving / rotating platforms

Just to get the right feeling what I am trying, I will put some parts of the my character controller.

   public bool PlayerCollisionCheck()
 {   
     return Physics.CheckCapsule(transform.position + Vector3.down*0.5f, transform.position + Vector3.up * 0.5f, 0.5f);
 }

  public void PlayerYCollision(float oldVelY)//this solves if player is in ground or in ceiling
     {
         int counter = 0;
         while (PlayerCollisionCheck() && counter++ < 100)
         {
             ySpeed = 0;
             if (oldVelY < 0)
             {
                 transform.Translate(Vector3.up * 0.01f, Space.World);
                 isGrounded = true;
             }
             else
             {
                 transform.Translate(Vector3.up * -0.01f, Space.World);
             }
         }
     }

Because of this way I cannot use the events(messages) like oncollisionenter, because I cannot solve them when more than one collisions occurs at the same frame.

The current version I made, have problems when you're touching ceiling and ground at the same time , you get teleported to top of the ceiling.

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

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

169 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

Related Questions

Player moving with platform 0 Answers

The random generated obstacles spawn outside the game platform 1 Answer

Preventing CharacterController sliding down edges on platforms, ground detection. 2 Answers

Grappling Hook in 2.5d Game 0 Answers

I'm creating a 3D platformer, but whenever my player goes down a slope, it thinks it isn't grounded, resulting in a weird animation glitch. 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