How to make Unity NavMeshAgent path around the player - unity3d

in my project there's a Unity Multipurpose Avatar Crowd that uses the NavMeshAgent component. However when in VR it will come very close to the player in a very intimidating way, it be best to avoid that. Been trying to get the to path around the player, but not quite sure how.
Things tried so far:
Putting a NavMeshAgent on the player - this makes them able to push the player if he's in their path
NavMeshObstacle on the player - this makes the AI sink into the ground if the player approaches them
Thinking the best way to do is in a script, but not entirely sure how to just slightly go around the player keeping the current desired destination.

Related

Personal First Person Cameras for each Player using Unity's 'Netcode for GameObjects'

I'm currently learning how to use Netcode for GameObjects and have just gotten the client, host, and server working as well as a movement script for the players that only effects each player individually. the only problem with it now is that when a new player is spawned, any existing players camera is changed to the camera that is spawned within the prefab of the new player. I have looked around online for a solution and this is the closest thing I could find but it's not done using Netcode for GameObjects and I'm not sure how to translate the information in the video over.
Any idea how i could achieve this?

Unity C# Rigidbody vs Game Object?

I'm currently making a game in which I do not plan on adding any physics to the player. Player will be moved simply by modifying the position and rotation directly through code on a grid. Should my player be a Game Object instead of a Rigidbody? Or something else entirely? I'm a little new to Unity and don't quite know what would be best for the player.
Your player is always a GameObject, your player can't be of type RigidBody If i understand your question right you want to know if it's better to use a RigidBody or a custom script tomove your player ?
For easier use, if you are new to unity i would advice you to use the Rigidbody. You simply disable the gravity on it. If you go for a custom GameObject it's going to be more flexible but you will have more work to do (like collisions, movement calculation, etc...). You can disable the gravity on a Rigidbody with "useGravity = false" via code or in the inspector.
If you want to make your own script:
Here is a video than will explain how to do it: https://www.youtube.com/watch?v=AiZ4z4qKy44&t=246s&ab_channel=Comp-3Interactive
else:
Rigidbody Docs: https://docs.unity3d.com/ScriptReference/Rigidbody.html
Hope it help. Have a nice day !

Is there a way to have camera follow g-force in Unity 3D (versioon 2019.3.15f1)?

I am making a game where at one point the player flies a plane/spaceship, and was wondering if there is a way for the camera to move slightly up when the player flies down, and vice versa, same for left and right so that it might make it feel better to play, and slightly more realistic then just a static camera movement.
Thanks a lot !
PS: Beginner here, so sorry if it's an obvious answer...
You can use Unity Standard Assets script CameraFollowsPlayer (Not sure of the name but it is something like this) and you drag and drop your character to your new Camera. It should do the trick with the delay movements. Alternatively you could use Lerp and transform Cameras Position in LateUpdate() method.

using unity physics with SteamVR

I want to make a plank game in VR with Unity. So when the player walk outside of the plank, he falls. Right now the only way to make it work is by using VRTK which is another physics system and it makes a lot of things complicated.
I've put a rigidbody on the CameraRig and uncheck "is kinematic". The player falls, but the colliders on other objects are not working anymore...
Is there a way to use Unity's physics with SteamVR and without VRTK ??
Thank you !
Firstly I would read up on Rigidbodies and Colliders/Trigger Colliders - here's a link.
Here's a useful table from that website:
You will need to use this to understand why the player is falling. Is the CameraRig actually colliding with the ground? Is it a Trigger Collider (which has a callback method but doesn't do any physical collision). There's many possibilities for why.
I wrote a script that you can drag in two objects and see if they collide. You could use that if it helps.
The issue in VR with Vive is that determining where someone walks can be difficult, as we are only tracking their head and their hands. If you have a Vive Tracker available and it fits your use case you could use that to track someones foot.
What I have done in the past is use the Camera(eyes) GameObject within the CameraRig and get it's transform.position.x and transform.position.z value to determine if it has gone outside of the boundaries of the object the user is standing on.
Hope this helps,
Liam

How to detect which block is closest to player? (Unity3D)

I am making a game simlar to MotherLoad. I'm trying to figure out how to mine downward. I've tried using OnCollisionStay and mining towards the block that the player is colliding with, but normally the player is on 2 blocks at once, so that isn't working.
Does anyone know a better method to do this?