feat: Debug Raycasts of Weapon
This commit is contained in:
parent
a9d662750c
commit
41ad534a7a
@ -251,6 +251,7 @@ public class RobotController : NetworkBehaviour
|
||||
protected void ShootServerRPC()
|
||||
{
|
||||
Debug.Log($"Shooting triggered. Owner: {OwnerClientId}");
|
||||
weapon.Shooting();
|
||||
}
|
||||
|
||||
[ServerRpc]
|
||||
|
@ -5,6 +5,8 @@ public class Weapon : MonoBehaviour
|
||||
// [SerializeField] private float damage = 10f;
|
||||
[SerializeField] private float range = 100f;
|
||||
[SerializeField] protected Camera mainCam;
|
||||
[SerializeField] protected float debugRayDistance = 5f;
|
||||
[SerializeField] protected float debugRayDuration = 2f;
|
||||
|
||||
public void Shooting()
|
||||
{
|
||||
@ -12,6 +14,12 @@ public class Weapon : MonoBehaviour
|
||||
if (Physics.Raycast(mainCam.transform.position, mainCam.transform.forward, out hit, range))
|
||||
{
|
||||
Debug.Log(hit.transform.name);
|
||||
|
||||
Vector3 rayDir = mainCam.transform.forward * debugRayDistance;
|
||||
Debug.DrawRay(mainCam.transform.position, rayDir, Color.yellow, debugRayDuration, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Debug Shooting
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user