Need to stop SteamVR camera seeing through walls - unity3d

I am using player prefab from SteamVR Plugin. Whenever player touches an object with a Collider on it, camera sees through it. I am using 0.01 as minimum clipping value. I have also added Rigidbody and Collider on camera.

I also do not have code currently but here’s a concept of how to approach the problem:
Keep a trigger collider on the camera.
Write a script that detects when that collider is within another collider (your walls). There is a method for checking if colliders are intersecting/overlapping
If there is an intersect/overlap, fade the camera to black. If there is not, fade back.

Related

Unity rigidbody always falling when on another rigidbody. (Unity 2D)

I'm relatively new to Unity, I have a player character and a box sprite, I want the box to be movable by the player and for it to fall, so I gave the box a box collider 2D and a rigidbody2D, the box moves fine and the player can move it OK, however whenever the player is touching the box in any way (standing on it or pushing it) the characters Y velocity begins fluctuating uncontrollably making it play the falling animation. Through some testing I found the problem was the player's rigidbody and boxes rigidbody interaction, I don't know how to fix it. Any help would be great thanks
I think u just need to set both the player character and box sprite 's rigidbody2D to dynamic with 1 gravity scale... u can change their mass to manipulate the motion...

OnTriggerExit collision with TerrainCollider

I'm trying to make a digging mechanism in my game by setting heights of the terrainData.
Everything works fine, but I found a bug. As can be seen on attached image, I put a Collider as a Trigger to check whether the whole terrain from the Trigger area is removed. I check it in OnTriggerExit method.
It works, but when I left some terrain 'in the middle' (as image shows) and removed terrain only around the Trigger is says that there is no collision with Terrain Collider (but it should be!!)
Thanks!
if your terrain has rigidbody in it will not detect collision because continous collision detection in terrain collider is not supported. one way to fix this is change terrain collider with box collider or remove rigidbody in terrain object.

How to have a pick able power up that has gravity and is not pushed by player?

Im having trouble with colliders and rigid bodies in my game.
I have a powerup that when a player touches gives the player a weapon upgrade, this is simply achieved with onTriggerEnter2D() and setting the collider on the powerup as a trigger. But the problem with that is the trigger does not even detect the ground collider on which the player is running and it just falls through the ground.
When I disable the trigger on the collider, the powerup, when spawned, falls to the ground and stays on it as normal, but then the player can't pick it up as it is just pushed around rather than being run through.
I have a similar problem with my enemies that should kill the player on touch. When I set the collider on them as triggers then they kill the player as expected, but fall through the ground since they have trigger colliders. But when I remove the trigger option, the enemies run on the ground as normal but never touch the player as the colliders of the enemy and that of the player push each other away and the gameObjects never actually touch.
How to solve this?
Thanks
You can use the method OnCollisionEnter2D(Collision) to detect collisions with non-trigger colliders, instead of OnTriggerEnter2D(), and it will still allow you to have your objects collide with the floor and not fall through.

Physics Raycasting In Untiy

I've set up a Physics Raycast Event System for the Google Cardboard in Unity, which works if I use a cube or any of the pre-set 3D objects. When I import my own object from 3DS Max, however, the Raycast doesn't seem to detect the object. I've checked, my object does have a collider on it, and the layer is set at default. I'm using the GVR API, and the GVR Reticle Pointer.
The problem is that the Collider is not even aligned on that imported Object. The center value of the Collider should be 0,0,0 so reset that. After that, click the "Edit Collider" button, go to the Scene View and modify the Collider until it matches the shape/size of your imported 3D model.
See the image I am talking about below for more info:

Capsule Collider doesn't move smoothly

I have some issues using CapsuleCollider and RigidBodyController in a Player GameObject in Unity.
Using a CapsuleCollider as collider for the player, I noticed that the player doesn't move like a capsule or a sphere (in other words, I want that the movement should be like a rolling ball, with no stuttering), but its movements like more like a box pushed, with stops and starts, that make some little oscillations of the camera.
Any ideas, solutions or tips?
realy that is all based on how your moving the object, and the rigidbody2D settings of the object, I think using physics forces would roll your character like a ball or capsule, however just setting a velocity wont.