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 /
avatar image
0
Question by cijolly · May 22, 2016 at 11:31 AM · layersworldspacelayerlocalspacelayercollision

Multiple interior collision spaces/pocket collision dimensions.

My game has a number of planets and ships, all of which have their own interior 'spaces' that the players are teleported to when they board the object. Multiple players and objects can exist in their own interiors at the same time, so I need to simulate all of the spaces simultaneously, without having them interact with each other. Ideally, the physics engine should also know that bodies in different spaces should ignore each other.

Does unity support multiple 'spaces' within the same scene? As in, multiple units could exist at the same world coordinates, without colliding with each other? And with only the cameras that exist in that space rendering objects within its frustrum?

I have looked at using multiple collision layers to represent multiple spaces, but they seem to be capped at 30 layers. If unlimited collision layers were possible, this would solve my problem.

My current solution is to place all of the interior spaces at (0, 0, 0) , and then separate them from each other by spreading them out along the z-layer so that entities in different interior spaces cannot collide with each other. I also place the Sun at (0, 0, 0), and make it surround interior space. The Sun is bigger than the maximum number of interiors * the max width of an interior. That way, objects in world space cannot interact with objects in interior space.

Is there a simpler, more elegant solution to having multiple 'pocket dimensions?' Carving off a chunk of world space to place the interiors seems like a bit of a hack.

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 Le-Pampelmuse · May 24, 2016 at 12:58 AM 1
Share

$$anonymous$$ultiple players and objects can exist in their own interiors at the same time, so I need to simulate all of the spaces simultaneously, without having them interact with each other.

It's even easier if you don't want them to interact with each other. Simply have your individual rooms, that are the interior spaces, and add everything that belongs there as a child of it. You don't need to have all of them at the same coordinates, do you?

The Sun is bigger than the maximum number of interiors the max width of an interior. That way, objects in world space cannot interact with objects in interior space.*

That seems fine as your planets (or suns) don't actually have a surface to go on. You could just leave them there.

Carving off a chunk of world space to place the interiors seems like a bit of a hack. That's how it's done. You could also make every interior a new scene, but that wouldn't really change anything except maybe loading times when switching.



I read in your comment on Oribows answer: Each interior space has it's own set of coordinates, centered on x,y = 0,0. The reason for this is this is to avoid moving levels colliding with moving units, which often causes unreliable collision

I thought those interior spaces are fixed inside the sun object? why are they moving?

avatar image cijolly Le-Pampelmuse · May 24, 2016 at 01:35 PM 0
Share

I've gone with arranging the interiors in their own regions in world space, inaccessible other than by entering the relevant ship.

In regards to your last paragraph, the interiors are not moving. It would be nice if they could move, because then I wouldn't have a problem. I could just have the interior levels positioned inside the ships that they belong to. Having stationary interiors that the players teleport to was my solution to the problem of emulating a moving ship interior.

avatar image Le-Pampelmuse cijolly · May 25, 2016 at 09:58 PM 1
Share

Oh, ok, so you want to actually see the outside from within the ship? Like Subnautica? But on a much larger scale(having crew members walking around)?

I'm no expert on physically correct simulation of child-systems within other systems.

But I got a cheap (but working perfectly) trick to propose: Have the interiors stationary, and use render target texturs with cameras placed on the window positions of the ship objects. When you are inside a ship, you would actually be in the stationary object, but the window textures render what the cameras mounted to the outisde of the real ship see.

It might help in your situation until you or the community can come up with an idea on how to manage the more realistic part.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Oribow · May 22, 2016 at 09:40 PM

You can make it work with only two layers, if interior things dont have windows. Have one layer for interior things and another for space things. Then just switch the camera render layer and the collision layer of the player between the two. There is no reason for giving each interior its own layer, when the player cant see on from the other. Second way: Have a new Scene for each interior level and just load it on teleport. Thats probably the cleanest version.

Comment
Add comment · Show 1 · 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
avatar image cijolly · May 24, 2016 at 12:09 AM 0
Share

I don't think a multiple scene approach would work, because multiple players/entities will be in different ships simultaneously. To my knowledge, Unity can only load one scene at a time.

Similarly, I don't think I can achieve this with only two layers, at least from a collision standpoint. Entities in different ships would collide with each other if they existed in the same space and the same layer.

Each interior space has it's own set of coordinates, centered on x,y = 0,0. The reason for this is this is to avoid moving levels colliding with moving units, which often causes unreliable collision detection and physics errors. Ship interiors are concave meshes, which also prevents them moving.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make UI elements behind game objects without using World Space Canavas 0 Answers

How to make raycast only collide with two layers? 3 Answers

Prefab changes the layer automatically (how do I stop it?) 0 Answers

Why does my GameObject move to the side when applying force on the Y axis (in world space) and then rotating it (also in world space)? 0 Answers

Ignore Raycast not working properly? 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