Unreal Engine AI not following in new level - unreal-engine4

I am using Unreal Engine and I created an AI player to follow third person character. This worked fine in the default Third Person Example Map, but when i created a new level, the AI failed to move.
I made 2 pawn sensing components, 1 for Chase and 1 for attack. The attack pawn sensing is working fine in the new level but it is not chasing the player.
The AI was supposed to follow the player but just punched when i came in the punch pawn sensing region.
AI BluePrint :

When you create a new level make sure that you have a NavMesh inside.
To quickly verify that press P.
If there is a NavMesh in that level it will turn green.
The default Third Person Example Map has already a NavMesh by default.

Make sure to add “nav mesh bounce volume” to your new level.

Related

Unity 2D: physics-based pathfinding package/library

I'm working on a small project where the goal is to defend yourself from mass enemy hordes in a 2d environment. The goal is to have the game be physics based, with enemies pushing against eachother to create a feeling of chaos.
Now I have a setup with enemies, a player and multiple obstacles all with a Rigidbody2D and 2D-colliders (mixed types, including polygon2D collider). Now I want to have the enemies chase the player. The obstacles however are polygon shaped rigidbodies, and thus are able to move.
So I want the "navigation" mesh of some sort to update on the fly, and calculate a navigation path for many entities.
Note: I don't know how many entities yet, but let's say ~100.
The things I tried to far:
Using the built-in NavMesh package from Unity. This package does not properly support the 2D configuration of Unity
Using the NavMeshPlus package. This implements a NavMeshSurface2D component to work with the 2D environment. I got this to work, but the NavMeshAgent component to steer the enemy does not use the force attribute of the rigidbody component, but rather just sets the speed or position of the transform. If someone knows how to use the NavMeshAgent or the NavMesh API in a way to get the target direction/speed via script, that would also be a solution
I tried the A* package. Which also works, but creates a very jagged line as it only can move in 8 directions (up,down,left,right and diagonals). It also cuts the corners of the obstacles, and does not take into account the size of the object (enemy) itself, so it hangs at the corners.
If anyone knows a good package/extension or the location of documentation of the NavMesh part, that would be great!
Thank you in advance.
So I got it to work and will share the solution I took:
Using the NavMeshPlus package, I created a navmesh.
Instead of using a NavMeshAgent, I configured an agent type in the navigation window with the right physical dimensions.
Next I added a script on the enemy to function as a custom NavMeshAgent.
Add a NavMeshSurface2D reference to the script (Serialized)
Using UnityEngine.AI, call NavMesh.CalculatePath(), with the AI.NavMeshQueryFilter. This has 2 components, the agent and area setters. Both of those I get from the NavMeshSurface2D reference.
Now you have the path the agent has to follow!
By the way, I'm also aware this could be done by a custom Agent inheriting the NavMeshAgent class, I'm also looking into that. Time will tell which one will have better performance.

Pathfinding and avoiding obstacles in unity with the ability to fall off the platform using physics

I'm trying to make a 3d game based on physics and looking for pathfinding/avoiding obstacle system for AI bots. They use Rigidbodies and .AddForce to move. I checked NavMesh and A*, but they use NavMesh Surface or another areas so NavMesh Agents cannot move out of its borders, while I need them to fall off the plarforms and die if they're pushed or drop to the platform below. I could somehow disable NavMesh Agent component when player pushes the enemy towards the edge, but there still will be the problem that bots cannot make a decision to jump off from one platform to another. Or maybe I should use raycasts instead of NavMesh and A* to avoid obstacles, but then I still need another pathfinding system. Is there any typical solution for this?

Problem updating position of grabbable GameObject in VR Scene using PUN2 and Unity3D

I'm trying to add PUN2 support to a simple Oculus starter scene (cubes on a table). I was able to run the official Avatar synchronization on top of my basic Photon2 setup.
This is the current sequence:
Player 1 ( P1 - the one using Quest) creates the room and joins it
Player 2 (P2 - the one using Unity Player) joins the room
Player 1 grabs a cube and moves it around
P2 sees the cube moving normally if P1 just drags it horizontally, but if he tries to lift it from the table the cube seems acting crazy from P2 point of view.
It looks like the cube fights with gravity but I'm not totally sure what is going on. You can see an example in this video where there is an alternation between horizontal drag and lifting from the table: https://gofile.io/?c=A9PN41
If I disable gravity on the cube it seems working fine (although the interpolation a bit slow compared to how P1 is moving the object): https://gofile.io/?c=jM4qEE
The point is that I cannot have cubes flying around the scene :)
Using Unity 2019.1 / PUN2 / Oculus Quest
For the records, I found out what is the problem but still working on a complete solution. When P1 manipulates an object (kept in sync across clients using Photon Transform View), P2 sees the cube trying to synchronize its position/rotation while fighting against gravity (creating that weird jumpy behavior).
After an extensive I research I found out a possible approach which could solve the problem:
Add a Photon Rigid Body View (sync velocity and angular velocity)
Add an RPC (activated during manipulation) which:
Disables gravity
Enables isKinematic
Transfer ownership to the Player which is manipulating the object.
This needs to be fully tested on both clients (Master/Normal), but so far the results seem promising.

Climb down ladder in 2D platformer game

For my game, the player character requires to climb up and down ladders those are placed in the gameplay area.
At present, I can able to climb up for my player character to climb down at present I don't have anyway. Because platform box collider applied with platform effector, so for the climb up, effector does not create any problem but now after reaching the top, it becomes solid platform so now I can't able to move downside.
For climbing up, I have followed this tutorial: How To Make 2D Ladders In Unity - Easy Tutorial
I am looking to implement some physics so I can reach downside to the ladder after reaching top.
You need 2 boolean variables isClimbingUp and isClimbingDown which depend on pressed key and a second ray, which will check -Vector2.up direction. Then just add one more 'else if' statement for down direction.
Yes, I have managed to solve this, and the game is published in the stores.
You can check using the below link:
Humpty Trumpty's Border Wall
This is my overall physics setup for the stair:
I have applied a trigger collider to my stair object and disable player gravity scale when the player within the stair.
Then after within the trigger enter and exist, I have done this:
Physics2D.IgnoreCollision(m_CapsuleCollider, myStair.platformCollider, false);
Disable collision between player and platform colliders when the player is within the stair.
I don't think, Platform Effect 2D becomes useful to me in this process but I didn't remove this to remain in the safer side.
So you have to keep a reference of the platform object which is attached to Stair.
I hope you will get a general idea to solve this problem.

How to make FBX model climbing on a slope

Related to the image below:
The Tank is a FBX model, imported with "Generate Colliders" checked. I want to make the tank walking the slope in front of it, which is just a resize cube from Unity ediftor. I tried different approaches : I added a rigidbody to the tank (receiving a message error), I added rigidbody to the cube. Nothing works.
This is my Tank Setting Capture
Could you help me ?
You Should Uncheck the 'Is Trigger' Option for that cube, So that it'll stop Your Tank colliding in to the Cube
One option you could try is implementing NavMesh and NavMeshAgent in your tank and environment. NavMeshAgent allows you to choose how big objects the agent can ignore and how steep slope it can cross etc.
Basic NavMesh implementation can be found on the unity docs: Unity Building navmesh
Remember to set all the environment as navigation static from the navigation menu in order for agent to realize that it can climb over them etc.
Maybe a bit silly, but do you have a mesh collider added to the tank object?