How to make camera shake when player collides with an obstacle? - c#

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.

Related

How to make realistic shot in Unity

I'm just wondering how to make shots in my game more realistic. I mean there are two main ways in implementing shots. First: throw a small projectile and let it detect collisions. Second: use raycast. But in real world (and apparently I noticed this in PUBG) bullets fly really quick but not immediately. Here is why you should aim near your target if it's far away from you to hit it. Because if you aim right where it is it will move and your bullet will miss the target.
I'm just curious if any of you, guys have a nice solution to this problem. Also I wish to find a way to use raycast not every frame. In such things like detecting if you will actually hit the wall when shooting. If you have any good ideas how to implement spread and recoil for different types of weapons I will be happy to read them.
Blue point is bullet point of frame. and in very frame send a new raycast to check cross any human. like red line in this picture.
and bullet path use unity built-in Physics system to do it.

Effective way to make NavMeshAgents jump/climb obstacles in Unity?

So I'm working on a zombie game and I want my zombies to be able to climb/jump over certain obstacles around the map. I know that I can create nav mesh links to achieve this but when doing it it feels forced as the zombies will go to the link to connect the climb/jump instead of just going over the obstacle. I am having trouble in my research finding an effective way to do this.
Basically here is what I want to achieve:
1.) When a zombie reaches a certain obstacle (fence, car, crate, etc.) that is climbable, instead of running around the obstacle to get to the player I want the zombie to climb or jump over the obstacle.
2.) When the player climbs on top of an obstacle I want the zombies to also be able to climb on the obstacle to be able to attack the player.
Does anyone have suggestions on effective ways to go about this or possible methods I could further research? From the hours I've spent researching this I'm not having any luck finding something that goes with what I want to achieve.

Sprite flipping in unity

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

Unity3d detect the click on a plane

I'm trying to detect when the user click on a plane in C#. I tryed OnMouseDown() but it has no effect.
According to some topics on the web, the object must have a collider, but my plane has one.
I also found topics talking about raycast, but I must admit I don't really understand what it is and what it does. Could someone lead me to a good and (relatively) simple exemple that explains well how to do what I would like to do?
Thanks, have a good day
From my previous comment, the plane was marked as Trigger.
"This function is called on Colliders marked as Trigger if and only if Physics.queriesHitTriggers is true." from here.

How to make a decal (How can I project a texture to a complex geometry?)

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.

Categories

Resources