Fixed RayCasts
This commit is contained in:
5246
Assets/Scenes/dont touch me plz.unity
generated
5246
Assets/Scenes/dont touch me plz.unity
generated
File diff suppressed because it is too large
Load Diff
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
8
ProjectSettings/ProjectSettings.asset
generated
8
ProjectSettings/ProjectSettings.asset
generated
@ -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
|
||||
|
Reference in New Issue
Block a user