Questions about raycast and it's usings

Hello, i’m wondering for a while about this two points:
1 in my game raycast start from cam till the position of mouse pointer, this is troublesome coz it hit also the player, if i place an object over the player head can i use that as start of raycast? (it has to be a cam?)
2 if i use a fixed cam instead a trailing one as it is now when the player is close to walls it will be not visible, can i use raycast from cam to player to make the walls transparent or there is a better way?
Thanks

  1. You can start and end a raycast from and to anywhere in world. It doesn’t have to be from the camera. The camera is generally used as it’s a good starting point for mouse picking.
  2. You can use a trigger around the camera and hide any entity that enters it. This might be tricky if your whole world is one mesh though. Doing a raycast from the camera to the player to see if any objects are obstructing the view would work as well but you need to do multiple or use your own custom raycast function in case there are multiple objects obstructing.

Thanks @steven i will rebuild raycast for movement from an object above the player so the player itself wont be in the way. About the second point, i will make a second raycast so when objects are in the way the will be transparent should be something like this i guess
this.target.findByName(‘Model’).model.model.meshInstances[0].material.blendType=alpha;
this.target.findByName(‘Model’).model.model.meshInstances[0].material.opacity=0.2;
or i miss something?