I have been looking about the forums but none of the other answers seem to be any help. I created a layer that I want one of my raycasts to ignore.
private int layerMask = 1 << 9;
Ray pointerRaycast = new Ray(transform.position, transform.forward);
RaycastHit pointerCollidedWith;
var rayHit = Physics.Raycast(pointerRaycast, out pointerCollidedWith, layerMask);
if (pointerCollidedWith.transform.tag != "Wall" && ObjectProperties.WallObject == false)
{
lastInstantiated.transform.position = new Vector3(pointerCollidedWith.point.x, pointerCollidedWith.point.y, pointerCollidedWith.point.z);
} else if(pointerCollidedWith.transform.tag != "Floor" && ObjectProperties.WallObject == true)
{
lastInstantiated.transform.position = new Vector3(pointerCollidedWith.point.x, pointerCollidedWith.point.y, pointerCollidedWith.point.z);
}
{
}
For some reason this code isn’t doing anything?