Projecting procedural attack telegraph decal in Unity - unity3d

I'm creating an isometric 3d brawler in Unity. I'm trying to draw a telegraphing "attack area" effect on the ground (Meshes, not Unity terrain), from an arbitrary polygon (including curved lines.), based on Vector3 points.
I figure I need to use the Unity decal system, but I'm not sure how to generate the area texture procedurally, especially since it needs to match points in 3d space. Here are a few examples of the effect I'm looking for.
Thanks for taking your time to read this :)

Related

2D Sprites in Isometric 3D Unity Project

The project works under a isometric orthographic camera, in a 3d space using 2d sprites.
What we are using are billboarding sprites into 3D colliders to archieve the 3d feeling.
The problem is that we don't really believe the way we are doing it it's the most optimal. We are also having problems introducing high areas, because we need to reply the sprite form in isometric perspective as colliders.
Because we are using 3D world, the tilemaps tools conflicts with the other vertical sprites.
We can not use a entire 2d floor billboarding sprite because that suposes to have a huge vertical sprite in front of the camera, so we can not display the others.
We are just researching for a solution before to change to a 2D world.
If you plan on sticking with isometric in 3D, get rid of the tilemaps entirely. They are just going to give you a headache and make your game lag itself to death. If you want to convert to entirely 2D isometric, you can stick with them as they would work fine. Now, a few comparisons between the 2D and 3D approaches, and how best to approach them. This is a jumbled list of drawbacks/advantages to each type, so it's more of a ramble after this point than an answer, but I couldn't be more specific without knowing more about your project's overall requirements and specifications.
Unity recently added Isometric Tilemapping as a dedicated feature. So, if you choose to fake it with 2D, your life will be a lot easier.
Controls are a lot easier in 3D, as the physics won't ever have to be
faked.
3D allows foreground objects to automatically cover up background
objects without having to add an arbitrary system to achieve the same
effect.
2D is fundamentally faster than 3D, and if you're aiming for mobile,
that's going to be very important to your project's success.
3D allows you to rotate your camera if you design it right. (Check out Don't Starve Together for an example of this design).

How to make pseudo 3D or 2.5D effect?

After using Unity for over a year now for creating 3D games I'd like to do my first pseudo 3D or 2.5D game (or whatever it's called). What I mean is games like Clash of Clans or Boom Beach where objects are really 2D images rendered to give 3D feeling. Because I don't even know the correct word for that type of games it's really hard to get started. What I can think of is giving Camera rotation of (45, -45, 0) so that it looks down at the ground from the upper right corner and then creating empty gameObjects with Sprite Renderers and setting their rotation to (22.5, -45, 0) so that they face the camera. I don't know if that's how it's really done so could somebody give me a link to some neat tutorial or something because I'm stuck.
The keyword you are looking for is isometric projection.
You can use Unity to create that effect with 3D graphics. You need to set the camera rotation to (45, -45, 0) and set the Camera Projection to Orthographic.
If you want to only use 2D graphics then the graphics are made in such a way that they are drawn in an angle that it looks like you are looking at them in 45 degrees.
If you search for isometric unity then you should find a ton of tutorials for Unity.

What is the most efficient way to create a group of 2D tiles with 2D colliders in Unity3D?

First of all, I am using Unity3d.
What is the most efficient (in terms of memory) way to create a group of 2D tiles with 2D colliders using a texture atlas (and tile data)?
Background Info:
I am working on a 2D terrain generation asset. It is a very similar generation style to Terraria's random generation. Currently, each tile is being instantiated as a separate GameObject. As I now know, this is extremely inefficient, and I should use a texture atlas and tile data instead. Here is a link to a tutorial I have been following that deals with this in 3D: http://studentgamedev.blogspot.co.uk/2013/08/unity-voxel-tutorial-part-1-generating.html
The problem is that mesh colliders are 3D colliders; 3D colliders CANNOT collide with 2D colliders. Currently in Unity, there are no 2D colliders (that I am aware of) that have the properties of a mesh; I need to dynamically change the 2D collider to adjust to the positions that contain tiles. How am I supposed to develop an efficient 2D tile system using 2D colliders?
Here are some of my ideas of techniques that may work:
Add a box collider 2D component to the chunk GameObject for each tile in the chunk.
Somehow dynamically use a polygon collider 2D to stretch over all solid tiles.
I have read through several threads and cannot find a good approach for this problem.
I am mostly looking for a proven technique/approach to this issue, but I am open to any suggestions or techniques. I am happy to provide clarity as needed. Thanks for any answers! I appreciate the time you put in to answering my question -it helps a ton!
As you rightly said, 2D colliders do not work with 3D colliders. The correct approach would be to pick one or the other.
If you are mixing 2D and 3D objects, go with 3D. You can restrict the axes in which your objects are affected by physics as explained in this answer.

Unity3D: terrain object's textures flickering on long distances

I'm making RTS project on Unity3D.
I created terrain with Unity's standard Terrain tool, and added textures of grass, mood etc. on it. Then, for creating "man-made" objects of terrain (roads, sidewalks, road curbs etc) - I'm created this objects in separate assets, and placed on terrain.
And I have one issue with this solution. On moving camera away from the terrain, terrain's texture(e.g. mood) are flickering under roads, sidewalks and other objects. AFAIK, this bug caused by insuficcient accuracy of floating-point coordinates in Unity3D engine (?).
Now, as I concerned, my approach to creating terrain objects is not correct. I must create one mesh with terrain, and all manmade objects in 3D modeling software, and then create UV-map for texturing all of it. Is this approach correct? If "yes", is any special approach for modelling and texturing so large and complex object as terrain?
I had the same issue time ago and I solve it by increasing camera's near plane value. I had many objects on the plane that were flickering when moving the camera and was due to having the near plane value at 0.01. I change it to 0.5 and none of the objects where flickering anymore.
I hope this helps!

Can a Polygon Collider 2D work with a Mesh Collider in Unity?

EDIT: This is now a rather simple question. I have a 2D sprite that really needs the precision of a polygonal hitbox. The 2D, tile-based world around it uses a tile Mesh for efficiency reasons, and thus has a Mesh Collider.
Before, the tiles in the world were each GameObjects with Box Colliders and Rigidbody 2D's, and the ship and the tiles collided just fine. Now that I am using a Mesh Collider, however, they cannot collide. (I have read that this is because one is 2D and one is 3D.) So what should I do to get collisions (preferably with rigidbody physics) between a polygonal ship and a 2D tile mesh? [end edit]
In a 2D, tile-based, procedurally-generated, chunk-based exploration game (in Unity 4.5), I have a player ship which uses a Rigidbody 2D and a Polygon Collider 2D for collision detection.
This worked fine back when I used a Rigidbody 2D / Box Collider 2D for world tiles. However, this is horribly slow, so I replaced the discrete blocks with a tile mesh, using a Mesh Collider and other associated paraphernalia.
The problem is: I simply cannot get collision detection to work. I have tiles on the x-y plane, and the collision mesh (I can see it in the Scene View, so I know it works) consists of four rectangles perpendicular to the tile. (If you can't visualize this, I don't blame you. See here.)
What have I looked at so far? Well, I verified that the (2D) ship actually passes through the collision boxes in the Scene View. Also, neither of the colliders "Is Trigger".Since there seems to be no official documentation on how to actually use meshes (is there? Where?), I can't find out whether Mesh Colliders and Polygon Colliders actually can interact. Because one is 2D and one is 3D, does this not work? If so, then what should I do instead? I tried using a Box Collider [3D] for the ship, but this didn't work either. I could have potentially made a mistake here, though.
Am I supposed to handle the collision manually (with the OnCollisionEntered [or something] method)? Before, the rigidbody2D objects handled everything automatically. Otherwise, is there any other possible reason the collision might not work?
Well, I'm quite disappointed there seems to be no built-in way to do this in Unity. My solution was to attach a GameObject to the player that would read the block data from the world and create (pooled, of course) real but invisible "collider blocks" with Box Colliders 2D in a small area around the player, such that the player could collide with blocks near them. It works great, and I also implemented an algorithm to spawn rectangular collider blocks over groups of blocks; this eliminates the "ghost pixel" bug in the 2D physics engine.
Uni2D plugin (https://www.assetstore.unity3d.com/en/#!/content/3826) automatically creates 3d colliders (as a group of mesh colliders) from any 2 texture with transparency. A bit expensive but works.