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
4
Question by Vitam · Jun 14, 2014 at 10:14 PM · 2d-physicsplatformer3d models

Is it OK to use 2D colliders with 3D models?

I'm planning on making a platformer with 3D models, but 2D orientation. Is it OK for me to use 2D colliders while using 3D models and perspective view? Will it work correctly or am I going to face some problems?

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

5 Replies

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

Answer by Wisteso · Jun 15, 2014 at 02:36 AM

This question should have far more information for a complete answer.

The short short answer is "yes", you can use 2D colliders with a 3D game. The long answer is that some things wont work that way, and some things will.

  • Detecting mouse clicks = generally fine with a 2D collider

  • Detecting if two objects intersect = you might have some issues with 2D colliders

  • Using very small collider areas = 2D colliders have some bugs that 3D colliders do not have

Comment
Add comment · Show 3 · 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 Vitam · Jun 15, 2014 at 02:57 AM 0
Share

What do you mean by the intersect problem? I might have to define "zones" with trigger colliders, where player variables change depending on actions inside those zones. Is it a problem with 2D colliders?

avatar image Wisteso · Jun 15, 2014 at 06:04 AM 0
Share

That probably wont work, if you mean you'll have 3D and 2D objects colliding. See http://answers.unity3d.com/questions/580769/can-rigidbody-2d-collide-with-3d-colliders.html

avatar image Vitam · Jun 15, 2014 at 06:44 PM 1
Share

It'll be all done with 2D colliders

avatar image
5

Answer by Kiwasi · Jun 15, 2014 at 07:53 PM

As long as everything is done with 2D colliders you will have no problem. I have done the same thing on one of my games.

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 aklgupta · Jul 20, 2018 at 03:20 PM 0
Share

Thanks. I am thinking of trying the same thing, all 3D models to have 2D colliders.

avatar image
3

Answer by sedativechunk · Jun 15, 2014 at 08:45 AM

I am actually making a side scroller "2.5D" game myself. It is 3D models from a side perspective. So what the other poster here said is correct. There are bugs/issues you will run into but it is possible. In all honestly, though, you might want to avoid it. I honestly have not played with a hardcore 2D game in Unity myself. But one thing I can tell you just from working with making a crosshair appear on the screen in a 3D environment with objects firing at the position of the mouse, well, it was extremely difficult and time consuming. When you are trying to make 3D objects interact with 2D objects, you get into some very complicated physics at times. Even when using Unity's simple functions, documentation, and framework, things can be very finicky and frustrating.

2D/3D mixtures generally involve "raycasting", a word in my top five most hated words of all time. Raycasting involves the tricky of where, one object that is close to you and not in 3D space has to intersect/interact with objects in a 3D space. So if you fire a rocket in 2D space on your screen and are trying to hit a 3D object -10 units on the z axis for example, you are going to have a somewhat difficult time pulling it off. If you have a lot of 3D objects but want a 2D game, what you can do is use 3D planes. Planes are 3D but you can put 2D graphics on them and they can still collide easily with other 3D objects. I even use them in my game, and they are nice because they scale with Unity units so your objects will look good on all screen sizes. The downside is that it will be somewhat difficult to get teh sizing/scale of your 2D graphics to proportion correctly on planes.

I highly recommend you experiment first before committing yourself to a game with a combination of 2D/3D collisions because some of the physics behind it can get a bit complicated. Good luck.

Comment
Add comment · Show 3 · 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 Vitam · Jun 15, 2014 at 06:51 PM 0
Share

I see, but at first I wasn't thinking about mixing 2D and 3D colliders, I'm using 3D models, but 2D colliders on them. Appreciate your answer though, thank you :)

avatar image ByteSheep · Jun 15, 2014 at 07:04 PM 0
Share

Technically if all the colliders in the game will be 2D then there shouldn't be any problems as far as I am aware. Adding a 2D collider to a 3D mesh should work the same as adding a 2D collider component to a 2D sprite plane. $$anonymous$$ixing 2D and 3D meshs shouldn't be a problem as long as you don't need to mix 2D and 3D collisions.

avatar image Owen-Reynolds · Jul 20, 2018 at 04:17 PM 0
Share

If you've got some 3D colliders, it seems easiest to avoid 2D colliders completely. Just use a thin box collider. I've used 0.1 for z and never had problems. I think a 3D plane collider is really a mesh collider, so a box will even run faster.

If it helps, Unity had 3D colliders first, and people made perfectly fine 2D games using them. Simplified 2D colliders, and 2D mode, were added later.

avatar image
1

Answer by Owen-Reynolds · Jul 20, 2018 at 04:07 PM

The trick is remembering that colliders are used to fake where something counts as being. The way it looks and where the collider says it is are independent. This can be a little confusing, since Unity tries to add the "correct" collider to objects -- but we know we can delete the free box collider on a cube, add a sphere collider, and it works just fine. Or we can have an 3D spaceship model, but using a sphere collider (which is good enough for weapons fires and crashes.)

A basic 2D game could start with 2D colliders with colored squares moving around. Then you'd add better textures or sprites with transparency, keeping the colliders the exact same since you liked that gameplay. Or, add 3D models, also with no change to gameplay.

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
avatar image
1

Answer by aklgupta · Jul 21, 2018 at 10:03 AM

As @Kiwasi has mentioned, it will be okay as long as there are only 2D colliders. I tried and tested it recently. Also, in my research, I learned that 2D colliders and 3D colliders can not interact with each other. And since we can not have both on the same game object, in case you want both to interact with one another, a workaround would be to add an empty child to any of the objects, say the 3D collider object, and use that empty object to detect any collisions with other 2D colliders.

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to move a character in front of a collider and be able to jump and be on top of the said collider? 1 Answer

2D 360 degress platformer example needed 0 Answers

Rigidbody2D.AddRelativeForce not working 1 Answer

3D Models in 2Dgame 1 Answer

Character animation jerks when moving 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