|
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!
(comments are locked)
|
|
How about this:
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)
Dec 05 '09 at 12:47 AM
Stelimar
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)
Dec 05 '09 at 12:51 AM
duck ♦♦
edited answer to reflect stelimar's suggestion
Dec 05 '09 at 12:54 AM
duck ♦♦
I don't recommend using the Unity plane. It contains 200 triangles. You only need 2.
Dec 05 '09 at 07:02 AM
Jessy
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.
Dec 05 '09 at 08:37 AM
duck ♦♦
(comments are locked)
|
|
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. 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.
Dec 04 '09 at 10:05 PM
Disaster
(comments are locked)
|
|
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! 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!
Dec 05 '09 at 12:27 AM
duck ♦♦
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.
Dec 05 '09 at 03:55 AM
Jessy
(comments are locked)
|
