Unity 3D One Way Wall - c#

I'm making a game in Unity 3D, and I'm looking for a one-way wall. In Unity 2D, there is a simple one way platform (PlatformEffector2D) that can only allow a player to go one way. I couldn't find something similar for 3D. Is there something simple like the PlatformEffector2D, but for Unity 3D?

Try to have a collider at the start of the way when its trigered disabled the rotation of the player. and then use function
Vector3.RotateTowards
to your desired direction.

Yes. You can check which side of the wall the player is in by finding the position of the player and the wall. If he is on the desired side for passage through the wall, make the wall on a separate collision layer than the player. If it is on the the other side, then make the player and wall on the same collision layer.

Honestly if you are looking for a one way wall. You might want to look into using a raycast. Project a raycast in the direction where the character should be able to walk through the wall. If that raycast hits the object then remove or set the collider to be a trigger.

Related

How to turn off Pathfinding in navmesh unity?

I use navmesh agent for my Isometric game (diablo like)
how then in all diablo-projects did they make it possible to rest against the wall?
how to off pathfind in nav mesh agent ?
I just want to hit the wall (or game object)
Example
ExampleInPoe
I tried everything, I can't figure out how to do it
You have to use NavmeshObstacles like explained here https://learn.unity.com/tutorial/navigation-basics#5c7f8528edbc2a002053b49c in Step 5.
So your navmesh basically ignores the wall - but the object prevents the player from passing. During runtime you can just remove the object and the path will be walkable.
Update:
In order to force the player to run into the wall (I assume when you say 'rest' against the wall you mean that), you could add a script that recognizes the player when they're close and then takes over their movement to let them smash the wall.
But this isn't a specific question anymore. So I'd rather recommend that you check out the Unity Tutorial section: https://learn.unity.com/search?k=%5B%22tag%3A5d351f087fbf7d006af48180%22%5D And try to get a better understanding of navigation and player movement in general.

How do I stop jittery movement in Unity game?

My 2D game is not lagging, but for some reason the entire game world (except the player) is jittering when the player/camera moves. I tried parenting the camera to the Player and I tried using a script to make the camera move to the player, but it didn't help. It is worse if the framerate is lower, or if there are little frame drops. I use velocity to move the player. Using FixedUpdate (for the player and the camera) didn't help either, it just makes my player not jump every time I press the jump button. I tried searching but I didn't find a solution.
Honestly this is a really difficult and tedious problem to troubleshoot.
I've had issues previously with moving a game object by transform that had a rigidbody.
I've had issues where a rigidbody parent had a child with a rigidbody - also never do this, each hierarchy should have one and only one rigidbody, and that should be at the root level. A rigidbody will "inherit" or consider colliders at all levels at or below the rigidbody in the hierarchy.
I've had issues with a rigidbody that didn't have a collider.
I've had issues where the camera was attached to the rigidbody.
I've had issues where the interpolation settings were not set.
I'd really need to browse through the project and look at the setup to give any kind of specific feedback. Otherwise I'll say that rigidbodies and rigidbody motion is such a pain in the ass that I would recommend NOT using them unless you absolutely have to.
You can do collision checks as triggers without rigidbodies. You can code your own movement and gravity system pretty easily for 2D. The only thing you really need physics for is if you want to solve physics-based collisions, and there I would again say don't use it if you can help it. You can also programmatically add a rigidbody, like for a combat knockout, and add the knockout force and direction, but all the rest of the combat is using scripted motions.

Is there any way to use Navmesh with physics in unity using steeringTarget and CalculatePath()?

I am trying to make an enemy for my game, and I got it to work using Navmesh. The only problem I have is that my character controller for my player is rigidbody based, and I want the player to be able to push the Navmesh agent around. I think this can be achieved by CalculatePath() and steeringTarget, but I am still not sure how the code would work. Thanks in advance

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

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.

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