samana писал(а):А в _Pistol точно есть все эти свойства - Hit, point?
Синтаксис:
Используется csharp
public void _Decal()
{
Vector3 Direction = RaySpawn.TransformDirection(Vector3.forward + new Vector3(Random.Range(-Spread, Spread), Random.Range(-Spread, Spread), 0));
Ray ray = new Ray(RaySpawn.position, Direction);
if (Physics.Raycast(ray, out Hit, 200F))
{
if (Hit.collider)
{
GameObject dec = Instantiate(DecalPrefab);
dec.transform.position = Hit.point + Hit.normal * 0.019f;
dec.transform.rotation = Quaternion.LookRotation(-Hit.normal);
dec.transform.SetParent(Hit.transform);
if (Hit.collider.tag == "Sweep")
{
DecalScript = dec.GetComponent<Decal>();
DecalScript._Decal();
}
}
}
{
Vector3 Direction = RaySpawn.TransformDirection(Vector3.forward + new Vector3(Random.Range(-Spread, Spread), Random.Range(-Spread, Spread), 0));
Ray ray = new Ray(RaySpawn.position, Direction);
if (Physics.Raycast(ray, out Hit, 200F))
{
if (Hit.collider)
{
GameObject dec = Instantiate(DecalPrefab);
dec.transform.position = Hit.point + Hit.normal * 0.019f;
dec.transform.rotation = Quaternion.LookRotation(-Hit.normal);
dec.transform.SetParent(Hit.transform);
if (Hit.collider.tag == "Sweep")
{
DecalScript = dec.GetComponent<Decal>();
DecalScript._Decal();
}
}
}