|
|
@ -40,7 +40,7 @@ public class magnetGun : MonoBehaviour { |
|
|
|
private float normGrip; |
|
|
|
private Renderer lastTargetRenderer; |
|
|
|
private Color lastTargetColour; |
|
|
|
|
|
|
|
private float DragSave; |
|
|
|
|
|
|
|
//public GameObject magnetTipObject;
|
|
|
|
|
|
|
@ -59,7 +59,6 @@ public class magnetGun : MonoBehaviour { |
|
|
|
playerScreen = -1; |
|
|
|
|
|
|
|
normGrip = playerController.grip; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -148,7 +147,7 @@ public class magnetGun : MonoBehaviour { |
|
|
|
private void pickUpItem(Collider item){ |
|
|
|
if (item != null) { |
|
|
|
|
|
|
|
_playerSoundScript.PlayPickUp(); |
|
|
|
|
|
|
|
|
|
|
|
if (item == otherPlayer.GravityTarget){ |
|
|
|
otherPlayer.dropItem(item); |
|
|
@ -157,6 +156,8 @@ public class magnetGun : MonoBehaviour { |
|
|
|
|
|
|
|
if (item.tag == "moveable"){ |
|
|
|
|
|
|
|
_playerSoundScript.PlayPickUp(); |
|
|
|
|
|
|
|
playerController.animator.SetBool("Holding",true); |
|
|
|
//playerController.animator.SetTrigger("startHolding");
|
|
|
|
|
|
|
@ -164,6 +165,7 @@ public class magnetGun : MonoBehaviour { |
|
|
|
originalGravity = item.attachedRigidbody.useGravity; |
|
|
|
|
|
|
|
item.attachedRigidbody.useGravity = false; |
|
|
|
DragSave = item.attachedRigidbody.drag; |
|
|
|
item.attachedRigidbody.drag = 3.0f; |
|
|
|
item.attachedRigidbody.constraints = RigidbodyConstraints.FreezeRotation | originalConstrants; |
|
|
|
//camera.transform.LookAt(item.transform.position);
|
|
|
@ -209,7 +211,7 @@ public class magnetGun : MonoBehaviour { |
|
|
|
Vector3 direction = gravityWell.transform.position - item.transform.position + targetOffset; |
|
|
|
direction = Vector3.ClampMagnitude(direction,1.0f); |
|
|
|
|
|
|
|
item.attachedRigidbody.AddForce(direction * objectSpeed * Time.deltaTime); |
|
|
|
item.attachedRigidbody.AddForce(direction * objectSpeed * item.attachedRigidbody.mass * Time.deltaTime); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -219,7 +221,7 @@ public class magnetGun : MonoBehaviour { |
|
|
|
playerController.animator.SetBool("Holding",false); |
|
|
|
|
|
|
|
item.attachedRigidbody.useGravity = originalGravity; |
|
|
|
item.attachedRigidbody.drag = 0.0f; |
|
|
|
item.attachedRigidbody.drag = DragSave; |
|
|
|
item.attachedRigidbody.constraints = originalConstrants; |
|
|
|
|
|
|
|
if(topScreen) |
|
|
|