- Home /
2D/2.5D - plane collisions?
I am new to Unity. I'm working on a top-down 2.5D idea I had. The point is to do it a little bit like GTA2, where a bunch of flat sprites existed on a plane while some things (buildings for instance) were 3D.
So far I had a problem where if I made the player's "model" a plane with a rigidbody component, it would slide through the ground plane instead of colliding with it.
Making the player model into a cube works. But, it also means that all faces are rendered, which is a problem (since I can see them if the camera isn't exactly on top of the player).
But if I keep it as a plane on the other hand, will collision detection with other objects still work?
What do I do in this situation?
Answer by Fattie · Dec 30, 2012 at 08:44 AM
easy as pie!
1 - make a cube. it will be invisible. make it however thick, etc, is relevant to your work
2 - make the flat sprite. no in the Hierarchy, drop the flat sprite inside the cube - in other words, the cube is the parent of the image.
The whole thing will now bounce around (as if it is a cube) but it will look like a flat sprite (as if it's a flat sprite)
It is very common, ubiquitous, to do this in game engines. Your rigs, things, are constructed from various things stuck together, many of them invisible.
Hope it helps.
Secondly, for 2D, it is unbelievably easier to use 2DToolkit from the asset store - it is very widely used.
Thanks! That's a great answer. So as I understand, just make a plane as a child of a transparent cube.
As for 2DToolkit, it's pretty cool, but doesn't look like it's got good the 2.5D style I want. Also costs $65 and I'm still testing the water.
Hi cele - that is completely correct
"just make a plane as a child of a transparent cube"
1 - quite right
2 - I can assure that 2DT$$anonymous$$ is a perfect solution to use in titles like that. But in this economy nobody can be blamed for not wanting to spend even a few dollars immediately! :)
However just FYI it is probably realistic to say "it's almost impossible to do real 2D-containing jobs in Unity, without 2DToolkit". (or any similar competing product) It saves an unbelievable amount of time.
3 - you see how you're using a "plane" to drop sprites on. the unity example plane you are using is kind of useless - it has like 30 triangles. what you want for 2D sprites is a "simple" flat square made of two triangles, just the right shape. (indeed, this is precisely what packages like 2dtoolkit do) So in time you'll need a way to make "two triangle squares" like that!!
Funnily enough like a year ago I asked this same question, "is there a tool just like 2DToolkit, for simply making ONE flat box for a sprite" .../questions/247954/tool-to-make-one-sprite-from-a-pngtexture.html - unfortunately the answer is no
4 - funnily enough I love games with the "mixed 2D / 3D" vibe or "living paper" vibe and we work on that sort of thing a lot. I find it's basically always difficult to get just the look you want in your head. Certainly "mixed rigs" (connecting spinrgs, invisible boxes and the like) is critical! FOr example someone here was asking about a "hidden spring" solution /questions/370827/anti-gravity-vehicle-bounce-back.html
all the best
So 2DToolkit is suitable for this? Wouldn't it limit me in that regard?
Yes, 2DT$$anonymous$$ (or any similar product) is precisely what you use for the "sprite" part. We use it every day for "mixed" projects as discussed.
TBC such products do not "convert your app to 2D" or anything like that. It simply allows you to make 2d things WITHIN the absolutely normal Unity3D 3D projects.
Indeed I will give you a simple example - imagine you just have "a button" like floating on top of your scene. ("Buy more bombs" or whatever.)
That's a 2D thing in a normal 3D game right?
Indeed, many people use 2DToolkit (or a similar product) for every such button in all projects they do.
Don't forget - of course you CAN just use "a Unity plane" exactly like you have been doing! There's no problem with that. It's just that it uses a lot of tris somewhat wastefully, and it's inconvenient. So - good luck!
I'll give it a go. It's a shame they don't offer trials though. :(
Your answer