i am super new to unity and i was messing around with a 2D Rpg, i downloaded an asset from the store (https://assetstore.unity.com/packages/2d/environments/tiny-rpg-town-environment-88293) and i wanted to make my player change direction when he turns in a given direction, but the file only comes with up, down and left. i have looked online and cant find any way to flip the left sprite to right and then save it as its own sprite, trying to enter the sprite like this, sorry if i have explained this in a bad way adn thanks for reading
In Unity you can change the flip of a sprite using these options:
https://docs.unity3d.com/ScriptReference/SpriteRenderer-flipX.html
https://docs.unity3d.com/ScriptReference/SpriteRenderer-flipY.html
Related
I downloaded a maze sprite for expiremental purpose to use in my game and I'm trying to add colliders to the wall. But since the maze is complex, it is quite a lot of work to add a Box collider 2D to each wall.
I tried using the Polygon collider 2D and it was some sort of inaccurate mesh looking collider.Is there any better way to add colliders to a maze or is it possible to do it programmatically adding colliders by somehow detecting the structure of the maze?
Here is something similar to the maze I'm using:
Add comment
There are a few answers to this question, depending on your approach.
1. Sprite-based Approach (where you have an image of a maze)
Make sure that the sprite is transparent, and only opaque on the wall areas (a PNG image can have transparency). After you do this, then you should be able to attach a polygon collider to automatically create a collider. If the image is too big/complex like you say, then you might want to split it up into several different images (4 quadrants for example), and then arrange them and attach a polygon collider to each object. In general, the simpler a collider is, the more accurate and efficient it is.
The downside to the above approach is that you are having to do a lot of manual work. If you knew that you had a lot of hand-drawn mazes that you would need to build colliders for like this, then it might be worth automating the process described above with a script, but that could get complicated fast unless you know what you're doing. Essentially, the automation script could recursively split the sprite into quadrants, create corresponding GameObjects, and add PolygonColliders to each one.
Manually splitting the image in a photo-editing program or making an algorithm to generate the maze and colliders might be faster for you than automation, depending on how much you want to get into the code.
2. Algorithm-based Approach
Luckily, there are a lot of maze programming tutorials online. Most are for 3D mazes, but the logic is the same to make a 2D maze. If you're interested in this option, then I found tutorials on the topic here, and here. In order to add collision after the maze is generated in each of these tutorials you can add a BoxCollider2D to each side of each cell which has a wall (or if using a prefab, add a BoxCollider2D to the prefab).
I don't get how to make the camera shake when my player collides with the obstacle.
I can suggest you a lot of different ways to do it, depending on what you trying to do,
and what you already did...
Like, I can think you just started learning Unity and suggest you to use OnTrigger methods to detect collision with your player, then implement a method to apply a noise to your camera position.. But, is your cam a ThirdPerson one? FirstPerson? Fixed? 2D topdown? 2D platform? 2,5D?
Do you get it? Is important to follow the guide to Ask a Question... Try to answer these questions, saying what you already did, what you already tried and I'm sure you'll find help.
I am trying to make a day night cycle in which Sun/Moon in front of the Camera and its grab able but only moves in orbit around the steam VR camera rig.
I am able to make that object grab able using VRTK (its a toolkit for vive) but how can i move it like as if it is orbiting the camera rig and dose not deviate from orbital path.
I have no idea where to start it,
honestly i have tried nothing because i do not know where to start it or how can i be able to do this
help needed...
thanks.
You have several options if you search online, here is an example that could help you out.
And here are some more ideas.
Referenced from here.
I'm currently working on my FPS game and going to make bullet holes(decals) but google doesn't help me at all. I cannot find the shader or any source that explains how to. If anyone did something like this one please help. Thanks in advance.
I take it you are casting a ray when you shoot? This way you can detect where it collides with a wall. If you have not done this, you should start there. When you know where the ray hits the wall you can create a flat plane on top of the geometry with your bullet hole texture on it including a alpha texture.
I built a small MapEditor for my game in XNA. Now I want to build it in Unity3d, except I don't really understand how this works in Unity3d.
So basically what I want is to create a 2d grid, where I can dynamically add tiles to the grid. Each tile contains a 2d Texture.
I was thinking of using NGUI to help me with this. I want it to be a 2d game.
I've got no idea on how this works in Unity3d. I would appreciate it, if you guys could point me into the correct direction.
Thanks in Advance!
I think the Rotorz tile system is doing exactly what you are looking for. Have a look at: http://u3d.as/content/rotorz-limited/rotorz-tile-system/2UU