• 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 DanJC · Apr 25, 2013 at 07:27 AM · physicscollidertriangle

What's a rough start or outline to creating my own physics?

I'm working on a 3D platform game with a lot going on.

alt text

One of the things it does is have the ground morph beneath the character's feet as they run upon it.

Using Unity's physics and colliders, this limits me to:

  • only being able to morph a few hundred vertices worth of landscape at a time (because making a new mesh collider for each frame of animation is slow)

  • as well only being able to move the morphing terrain fairly slowly (to prevent the rigidbody character object from accidently passing through the moving mesh collider).

These limitations are something I can work with, but for this and other issues (like this one) it is often suggested I write my own physics instead. The problem: I just don't know where to start.

So here's a case example. My character is falling through the air with the fake gravity I have implemented. On the next frame it may or may not share the same space as a part of the non-collider surface mesh, shaped like a sick octopus. If it does "hit" I'll want to stop its fall and start working out gradients and direction to travel and such.

How do I get that kind of info with the surface's mesh data?

I imagine it's something along the lines of "Find where line pointing down interests triangle T", but how do I know which triangles to check. All of them? And could someone just confirm that assuming I do know which triangle to check, I should indeed use its 3 vertices to work out its plane.

Things like that. Just not sure where to start.

Comment
Add comment · Show 1
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 Loius · Apr 25, 2013 at 07:47 AM 0
Share

AABB matrices (yes, it sounds meaningless) are a thing that's used for finding bits of geometry within a small shell so you don't have to check everything. Haven't used them myself, just know the term.

Since you're building a very specific engine, you can cheat your way into a lot of efficiency that usually doesn't exist (as a general rule).

You could for example build your triangles such that, if that octopus is flattened, the triangle indices increase as you move +Z and +X. Then when you want to know what triangle you hit, you can search triangle indices near the last triangle you hit ins$$anonymous$$d of using math to find stuff.

Three points make a plane, yes. :)

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

12 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

Related Questions

What's a rough start or outline to creating my own physics? 0 Answers

Player gets stuck on collision when jumping up a platform. 3 Answers

Colliders have no friction?!! 1 Answer

Collider that can trip triggers that doesn't affect game physics? 1 Answer

Returning list of Triangles, Vertices or Points by raycasting through a mesh (iPhone) 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