Physics.queriesHitBackfaces = true;
↑このAPIを使えばいい!
5.5からのAPIです。
Shooter.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Shooter : MonoBehaviour
{
public GameObject testBox;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
Physics.queriesHitBackfaces = true;
RaycastHit hit;
if(Physics.Raycast(transform.position,transform.forward,out hit,1000)){
Instantiate(testBox,hit.transform.position,Quaternion.identity);
}
}
}