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 JasonBricco · Jun 05, 2014 at 08:43 PM · performanceraycastingvoxelbox collidercalculations

Collider Performance Question

Hey all.

I just have a simple question that I can't seem to find the answer to (maybe not looking very well).

If I have colliders that are not set to collide with anything at all, not each other, not the player, not anything, then:

  1. Are those going to be doing per-frame calculations to detect collisions (I would assume no because there's nothing they can collide with).

  2. Will Physics.Raycast still work against them if I test for that specific layer?

The context of this question is: I have a voxel game. And Mesh Colliders are terribly slow to update, so I took them out and added a system where box colliders surround the player where solid blocks exist. This is much more efficient.

However, I was using raycasting to place and delete blocks. I would cast a ray at the ground, it would hit the mesh collider, I'd get the normal and use that to figure out where to put the block.

I can't do that anymore, because those blocks no longer have colliders. There are only colliders around the player. So I figured I'd write my own very simple ray casting system that creates a ray and uses Ray.GetPoint() to advance along it 1 unit at a time, checking each spot for a solid block. If it finds one, it returns that position and I can either delete it or go back 1 unit to place a block.

The problem here is this method is not accurate. Often, the block modified is the neighbor block from the one I clicked. And I'm not entirely sure how to make it accurate.

So I could put box colliders around every block. But that's a LOT of box colliders, and given that they're doing per-frame calculations, I can't afford to do that.

But, if I can put a LOT of box colliders that aren't doing per-frame calculations, then it might be more do-able. So I need to know the answer to this question to figure out if I can do that.

Though it might be pretty bad on memory usage...

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Krizzen · Jun 05, 2014 at 11:21 PM

I don't know how Unity handles things internally, but I imagine they spatially partition the world using octrees. They probably have something internally like Leaf->HasAwakePhysicsObjects. Any decently fast physics system will have a "sleep" state for objects at rest.

I'd really like to know how Unity partitions the world for physics, since that could ultimately answer your question.

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

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

22 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

Related Questions

How do I calculate this voxel script so I don't get a out of range error? 2 Answers

Voxel performance 1 Answer

Box Collider Game Performance 1 Answer

Box Collider (Trigger) Efficiency Question 0 Answers

Voxel learning project performance issues 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