Gun holding with inverse kinematics

This commit is contained in:
juliuse98
2021-11-06 15:42:57 +01:00
parent 7cb0140a74
commit 4fc928f530
15 changed files with 715 additions and 545 deletions

View File

@@ -6,6 +6,8 @@ using Mirror;
public class Shoot : NetworkBehaviour
{
[SerializeField] GameObject muzzle;
[SerializeField] ShootAnimation shootAnim;
[SerializeField] float fireRate;
private void Update()
{
if (isLocalPlayer)
@@ -25,6 +27,9 @@ public class Shoot : NetworkBehaviour
{
GameObject dedplayer;
RaycastHit hit;
shootAnim.StartShootAnimation(60f/fireRate);
if (Physics.Raycast(muzzle.transform.position, muzzle.transform.forward, out hit))
{
if (hit.transform.gameObject.GetComponent<Player>() != null)