• 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
Question by Disaster · Dec 04, 2009 at 09:42 PM · 2dcollisionmesh

2D Gameplay... planes or cubes?

Hi there,

I was planning on putting together a 2d game, and I was wondering on the best way to go about making platforms. I was originally planning on have everything as a plane, but I'd like to use some physics and it seems that getting planes to collide can be trouble. With that in mind, should I go about making my platforms using meshes with a depth value of 1 (perhaps with the back and bottom faces deleted)... or is there a better method?

Any advise would be greatly appreciated!

Thanks!

Comment
Stelimar
Novodantis 1
CryptoQuick
Cyclops
Kanfi Games

People who like this

5 Show 0
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

3 Replies

  • Sort: 
avatar image
Best Answer

Answer by duck · Dec 05, 2009 at 12:24 AM

How about this:

  • Create a plane game object
  • Remove the collider component from the plane
  • Add a box collider component instead
  • Make the whole thing into a "platform" prefab
  • Use the prefab to build your levels :)

Comment
Stelimar
Novodantis 1
CryptoQuick
x4000
sacredgeometry
3Duaun
Cyclops
cquinones
Sean_The_Ripper
gamberetto

People who like this

10 Show 10 · 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 Stelimar · Dec 05, 2009 at 12:47 AM 2
Share

Why not create a plane object, remove the mesh collider, and add a box collider instead? That way you just have one GameObject, rather than 3 (the plane, the box, and the parent)

avatar image duck · Dec 05, 2009 at 12:51 AM 0
Share

yes, better idea! I was thinking that you couldn't add a box collider to a plane - but you're right, you can! (although there wasn't a third GO in my suggestion, just two)

avatar image duck · Dec 05, 2009 at 12:54 AM 0
Share

edited answer to reflect stelimar's suggestion

avatar image Jessy · Dec 05, 2009 at 07:02 AM 0
Share

I don't recommend using the Unity plane. It contains 200 triangles. You only need 2.

avatar image duck · Dec 05, 2009 at 08:37 AM 0
Share

Yes, if the triangle count starts to become an issue, this is something worth considering - however my feeling is that with a significant number of objects, draw calls will become the bottleneck much sooner than tri count, which would force the move to a different method of displaying the level platforms altogether.

Show more comments
avatar image

Answer by Design3.com · Dec 04, 2009 at 09:53 PM

Unity supplies a 2D Platformer tutorial here. If you use an orthographic camera an align your platforms-as-cubes to it, they'll appear to have no depth. It all depends on the look you're going for, so I'd read the tutorial, which talks about physics a bit, and see how it applies to what you're making.

This is an example of a 2D game without perspective made with Unity.

Here's another.

Comment
Novodantis 1

People who like this

1 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 Disaster · Dec 04, 2009 at 10:05 PM 0
Share

Hi. Thanks very much for your reply. I have given that tutorial a good read. My main query is that I'd prefer to use planes (less faces == more power!) but I don't want to use them at the cost of dodgy physics. Sorry, perhaps my question wasn't very clear.

avatar image

Answer by Jessy · Dec 04, 2009 at 10:25 PM

The physics system doesn't work with planes, and isn't tied to the rendering. Therefore, you'd probably be best off using textures quads for graphics, and sphere, capsule, and box colliders as appropriate. Make the box as deep as you like!

Comment

People who like this

0 Show 2 · 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 duck · Dec 05, 2009 at 12:27 AM 0
Share

Small note - the physics system does work with planes - you can collide rigidbodys against them, just not use them as rigidbodys themselves. But they won't behave nicely as platforms if you try and balance objects on them edge-on!

avatar image Jessy · Dec 05, 2009 at 03:55 AM 0
Share

It's an issue of semantics, I suppose, but I say it doesn't work with planes. You have four primitives to work with: sphere, capsule, box, triangle (mesh). You can "make a plane" out of a box or triangles (I suppose one could do if you stretched it out enough), but ultimately, no planes.

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta on June 13. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Having an array of points(vector2), how do I create a 2d terrain? (new to unity) 2 Answers

Generate collision mesh from 2d texture? 0 Answers

Best approach for collision in shape combination game? 0 Answers

Make Player Move Slow Over Grass 1 Answer

2D Collision problem 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