Hi I am making a 2d platformer game and right now I am working on the camera. while I succeeded in clamping the camera inside a rectangular shape, my game involves slopes, so I want my camera to be able to clamp inside a curved shaped too. Can anyone help me find an idea for the code?
Cinemachine gives you a flexible 2D camera controller, with the option to confine it inside a PolygonCollider2D. This section contains explanation for that and other cool things.
Related
I'm playing around with the rigging in Unity 2D and I was wondering is there a way to apply the bones from a sprite facing right and flip them to apply them to a left sprite and do the same for the animation? I tried to just flip the player, but it breaks the bone depth...
I would like to know how to avoid the animation being different when moving from right to left with 2D rigging? There must be a way to do it, they just don't show it in the documentation / tutorials.
I want to limit the area where my player can walk. In this case only on red segments.
And I want to use 2D sprites as background images not 3D models. But my main player would be in 3D
Can I use NavMesh here? Or should it be done with Tilemap? Or should I place some 3D objects above it?
here is another scene that I would like to understand how to build
You can try adding invisible colliders attached to an empty gameobject to prevent your character from walking into certain areas.
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.
SO I saw a tutorial online how to make a particle system, and I made it. Only thing is, I want to use it for a 2D Menu. So when I add the particles in front of the canvas, they don't show up in 2D. How do I make particles that will show up on a 2D menu?
You can try positioning your Canvas in World Space, then moving it behind the particle system. This will allow the Canvas to be positioned like all the other objects in your scene, and no longer be constrained to the camera.
Here's a guide from Unity on how to do it.
In Unity3d we have RaycastHit.textureCoord but it doesn't exist anymore in 2D. I was searching about this problem, a lot but I didn't find anything useful.
So I want to know the solution for this problem and I'm wondering why method like textureCoord in 3D doesn't exist in 2D actually in RaycastHit2D.
also I want to access to the pixel when mouse cursor on it.
It works in 3D because RaycastHit.textureCoord requires a mesh collider. In the 2D case it is way simplee because you can calculate the position yourself as you know the sprite hit, the cursor position and size of the sprite.