Fixed RayCasts

This commit is contained in:
2022-04-18 15:42:54 +07:00
parent 2fd9694679
commit 4bc5cb5ed2
3 changed files with 5264 additions and 4 deletions

File diff suppressed because it is too large Load Diff

View File

@ -66,7 +66,8 @@ public class scr_CharacterController : MonoBehaviour
public float range = 100f;
public Camera fpsCam;
public ParticleSystem muzzleFlash;
public GameObject impactEffect;
private void Awake()
{
defaultInput = new DefaultInput();
@ -110,10 +111,19 @@ public class scr_CharacterController : MonoBehaviour
void Shoot()
{
muzzleFlash.Play();
RaycastHit hit;
if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range))
{
Debug.Log(hit.transform.name);
Target target = hit.transform.GetComponent<Target>();
if (target != null)
{
target.TakeDamage(damage);
}
Instantiate(impactEffect, hit.point, Quaternion.LookRotation(hit.normal));
}
}

View File

@ -614,7 +614,11 @@ PlayerSettings:
webGLLinkerTarget: 1
webGLThreadsSupport: 0
webGLWasmStreaming: 0
scriptingDefineSymbols: {}
scriptingDefineSymbols:
1: CROSS_PLATFORM_INPUT
4: CROSS_PLATFORM_INPUT;MOBILE_INPUT
7: CROSS_PLATFORM_INPUT;MOBILE_INPUT
14: MOBILE_INPUT
platformArchitecture: {}
scriptingBackend: {}
il2cppCompilerConfiguration: {}
@ -712,5 +716,5 @@ PlayerSettings:
organizationId: unity_9asvqbkpr8e5lq
cloudEnabled: 0
enableNativePlatformBackendsForNewInputSystem: 1
disableOldInputManagerSupport: 1
disableOldInputManagerSupport: 0
legacyClampBlendShapeWeights: 0