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 /
This question was closed Nov 05, 2016 at 04:16 AM by Bunny83 for the following reason:

Question is off-topic or not relevant, Question can't be answered.

avatar image
0
Question by EnokV · Nov 04, 2016 at 10:36 PM · c#collision

PhysX: GeometryQueries - Is there a reason for why this haven't been fully exposed?

As the title suggests, my question is: Why haven't this been exposed?

http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/guide/Manual/GeometryQueries.html#penetration-depth

As the description of this function suggests, it takes two geometries along with their respective positions and then it calculates a displacement vector (direction * depth) which can be used to separate the 2 geometries via a translation.

Why would this be helpful, you may ask? Here's why:

In Unity(3D) there's about 2 viable options for you to have collision in your game. One is a rigidbody and the other is a CharacterController component. Both of these are good at what they do but they're by no means a universal solution and having the right parts of PhysX exposed in Unity would allow us to be a bit more creative with what we can achieve. Think custom character controller, this is quite a hot topic and at the moment and have been for quite a while too. See forum posts by @fholm, @IronWarrior, and @PhilSA.

I do not need newtonian physics in my game and for this reason, the rigidbody is not a good option. I also must be able to rotate the collider geometry of my character and for this reason, the axis-aligned CharacterController is also, not a good option.

I'm aware of ContactPoint which contains the separation and the normal, which in turn translates to what I posted above(The PhysX docs link), e.g. direction(normal) and depth(separation) but this is useless because you can only access it once a collision has already occured(which requires you to use a rigidbody / CC) and this is what I want to avoid.

Exposing this method as is, would mean that we could do something like this!

 void Update()
 {
     foreach (Collider col in Physics.OverlapCapsule()) {
         Vector3 direction = Vector3.zero;
         float depth = 0f;
 
         if (Mathf.CheckPrimitivePenetration(playerCollider, col, 
             playerCollider.transform.position, col.transform.position,
             out direction, out depth)) {
 
             //Move away from the other collider just enough to lick the surface of it
             transform.Translate(direction * depth);
 
             //Perform a raycast in -direction to get the point of collision
             //Store collision data in your own collision struct
         }
     }
 }

This would allow us to resolve our own collisions with ease and not reinvent the wheel, e.g. add our own engine like features because we just wanted some more accessibility(which in my opinion should have existed from day 1).

Hacking the rigidbody to make it behave like you want shouldn't be needed and it pains me to see this over and over again.

Now, allow me to repeat myself: Is there a partical reason for why we don't have this right now and will it be implemented any time soon?

Thank you for reading.

EDIT: Changed the indentation because it looked weird.

Comment
Add comment · Show 2
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 Bunny83 · Nov 05, 2016 at 04:15 AM 0
Share

I'm sorry that you put that much efford into writing this post, but this is not a question that the community can answer. You should post things like that on Unity feedback.

It seems you already did that, so i'm confused what kind of answer you would expect from the community?

Anyways, since the question can't be answered i'm going to close it.

avatar image Owen-Reynolds · Nov 05, 2016 at 03:08 PM 0
Share

If you're making a game now, and have a specific problem, I think asking here for a work-around or a close-enough would be fine.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

245 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 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

CapsuleCollider check if grounded 1 Answer

How to Make A Character Stop At Wall? 0 Answers

problem with tilemap collider and composite collider 1 Answer

Animator and collision issues 0 Answers

Adding different values to randomly created objects 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