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 /
This question was closed Jun 17, 2013 at 05:33 AM by robertbu for the following reason:

No specific question/Discussion Topic

avatar image
0
Question by neoshaman · Jun 17, 2013 at 04:15 AM · collisioncharactercharactercontrollercollision.contacts

Character mouvement and collisions in arbitrary angled surface

I wonder what you guy would do for a cheap replacement of character controller in unity. I try a bunch of implementation and they don't work at all, what I'm doing wrong?

I'm trying to make a game with megadrive's sonic pinball physics, think (technically) about mario galaxy meet tony hawk with sonic's high speed. Currently I use a simple raytracing, but I'm looking to listen collision around the sphere collider.

In my case i tried:

  1. Rigidbody turn the game in a slide show, Intel atom n455 for the win (actually I like the limitation so it can run on most machine).

  2. Kinetic body don't collide with scenery (don't listen collision).

  3. Character controller don't rotate.

  4. Sweeptest() and SweepTestAll() but walls and inward curve fails dramatically. + it does not work with the flash preview of unity 3.x

I want to be able to move the character according to tangent of arbitrary complex volumes. For example, taking slope change higher than 90° and leave the case handling with special case code (for example stopping at a wall or falling down a cliff)

What should I do to meet the requirement with good performance?

Currently my code is this one, with sweeptest() which doesn't work:

 private void UpdateSurfacePosition()
     {    
         Ray//origine, direction
             ground_check_ray = new Ray( gameObject.transform.position, -gameObject.transform.up);// * (Momentum.magnitude + 1));
         RaycastHit 
             raycast_result;
         Rigidbody
             rigid_body = gameObject.rigidbody;
         
         
         rigid_body.detectCollisions = false;
         rigid_body.isKinematic = true;
         
         
         
         bool onGround;// =
             //Physics.Raycast( ground_check_ray, out raycast_result );//ray, hit
             //rigid_body.SweepTest(-gameObject.transform.up, out raycast_result);//direction, hit, distance
         
         raycast_result = new RaycastHit();
         RaycastHit[] contacts = rigid_body.SweepTestAll(-gameObject.transform.up);
         
         rigid_body.SweepTest(-gameObject.transform.up, out raycast_result);
 
         
         if (contacts.Length > 0)
         {
             onGround = true;
             int i=0; while (i != contacts.Length)
             {
                 raycast_result.normal += contacts[i].normal;
                 i++;
             }
             raycast_result.normal = raycast_result.normal.normalized;
         }
         else
         {
             onGround = false;
         }
 
         
         debug1 = "Normal > " + raycast_result.normal.ToString()
             + " Position > "+ raycast_result.point.ToString()
                 //+" transform > "+ raycast_result.transform.name.ToString()
                 + " Contact > " + contacts.Length
                 ;
         
         
         if ( onGround )
         {
             Vector3
                 next_position;
             
             //UpdateOrientation( gameObject.transform.forward, raycast_result.normal );
             
             UpdateMoveOrientation( gameObject.transform.forward, raycast_result.normal );    
             next_position = GetNextPosition( raycast_result.point );
             rigid_body.MovePosition( next_position );
             
             
             //ground_direction = raycast_result.normal;
         }
         else//onAir
         {
             //if forward close to dot.Y = abs(1) choose -up if 1 and up if -1
             UpdateMoveOrientation( gameObject.transform.forward, raycast_result.normal );
         }
     }
Comment
Add comment · Show 3
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 robertbu · Jun 17, 2013 at 04:59 AM 0
Share

I don't see a question here. Plus this looks more like a discussion that should be handled on the Unity Forums. Unity Answers is structured to answer a specific technical questions.

avatar image neoshaman · Jun 17, 2013 at 10:47 AM 0
Share

well my code doesn't work, I lost the first post i apperently I lost the question gasp

avatar image neoshaman · Jun 24, 2013 at 02:59 AM 0
Share

O$$anonymous$$AY it's just that unity is shit for any complex gameplay http://forum.unity3d.com/threads/142375-The-limitations-of-the-physics-API-and-creating-a-character-controller

1 Reply

  • Sort: 
avatar image
0

Answer by neoshaman · Jun 17, 2013 at 10:50 AM

I have fixed it!

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

Follow this Question

Answers Answers and Comments

14 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

Related Questions

Pushing a character controller (physics interaction) 0 Answers

OnCollisionEnter not working 1 Answer

Character Collider doesn't collide with other Colliders 2 Answers

Merge 2d colliders, slow down character after collision 1 Answer

add camera collision without CharacterController 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