How to turn off Pathfinding in navmesh unity? - c#

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.

Related

How do I use trigger to destroy blocks on quest 2 unity?

I am making a game in Unity that is a combination of gorilla tag and minecraft and I am having trouble with using the RawAxsis1D.RIndexTrigger (top right quest 2 controller trigger) to destroy objects. (Some of my objects I'm trying to destroy have children.) I am also using raycasing so that it will make it so it will destroy the object the player is looking at, so far everything I have tried has failed.
Can anyone help me out? I am happy to provide any further info.
Main problem: when I add my script to my player, it did not do anything when the trigger was hit.

Unity - How can i make my turnbased AI movement move one at a time

Not sure if I described the problem correctly in the title, but I'm making a turn-based game and have the enemy movement AI finished. The problem I've got stuck on is making each enemy move separately:
Enemy 1: move and attack
Then
Enemy 2: move and attack
and so forth.
I suppose I could do separate scripts but that would just be a mess in the long run. Do any of you know a more straightforward way of doing it using the same script?
I'm kind of new to game dev and this forum so if this is posted in the wrong forum, please tell me where I should post it instead:)
I propose the following solution, use a public static UnityEvent when you put each enemy's logic then call each method of the UnityEvent one by one when it's the enemies turn to play.

Unity 3D One Way Wall

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.

Unity Multiplayer Cube Auto Move?

I have followed the Unity official Multiplayer Guide below and everything works, except for the fact that when I run two instances on the same computer (1 in build run and the other in the play mode) the characters for some reason auto move in a circle.
I have no idea why this is since I have followed the tutorial exactly, unless I missed something :P I am currently on step 9 (identifying local player) and I stopped there cause my players keep moving in circles.
To Clarify, they aren't spinning in place, they are walking in a circle. Just imagine a person following a dotted circle on the floor, same idea.
This issue only happens when i run two instances (build run mode and play mode in unity). if i try only the play mode in unity, everything works fine.
Has anyone experienced this before?
Unity Multiplayer Tutorial: https://unity3d.com/learn/tutorials/topics/multiplayer-networking/network-manager?playlist=29690
I am on version 2017.2.0f3 <-- maybe this is why? should I update to a different patch?
Thank you in advance
Where I spawn the characters
build and run, player just moves in circles automatically
both build run and play mode, they both again moves in circles automatically
I see a first issue in your code:
PlayerController.cs line 36, you wrote
var bullet = (GameObject)Instantiate(BulletPrefab, BulletSpawn.transform.position, BulletSpawn.transform.rotation);
it should be
var bullet = (GameObject)Instantiate(BulletPrefab, BulletSpawn.position, BulletSpawn.rotation);
Since BulletSpawn is already a Transform. Otherwise bullets might not fire in the gun direction.
I don't have any of the player moving without me pressing keybord key.
Here is a screenshot of 2 build run working good:
I also tried Build run + Unity Editor in game mode, I had no problem.
Maybe the problem comes from your keyboard or the input manager of unity ? Since you are using Input.GetAxis, check this https://docs.unity3d.com/Manual/class-InputManager.html
The issue with your character automatically moving is because you have something plugged into your computer that acts as a controller/joytick. Go into settings for controls and set all joystick to the last joystick #. Make sure you set this for all vertical and horizontal movement. That should do the trick.
For example, if you use a 3D mouse like 3D connexion, it could act as a joystick/controller and auto move your character.

Issue implementing proper collision in XNA Game Studio 4.0

I am building a game in XNA 4.0, where a player moves about a 2 dimensional (vertical perspective) map consisting of blocks. My issue is creating proper collision between the payer and the blocks (basic game physics.) The player moves more than 1px per frame, so .Intersects() just isn't enough, I need physical contact collision that can function in a gravity environment. The current version I currently have is a piece of garbage and only works occasionally.
Basically, all that the collision system needs to do is stop gravity when the player lands on a block, and provide some decent physics when the player hits blocks (movement in that direction ceases). The idea behind my current solution is to move the next Position around until it finds a clear spot, but it doesn't work well. I have an idea why, just have no idea how to do it properly.
I know there must be a better way to do this. What would be the best method of making this kind of collision work properly?
Thanks
This does the job perfectly, you just need to sort through a few syntax errors. http://go.colorize.net/xna/2d_collision_response_xna/

Categories

Resources