- Home /
how get bow to add more force over time
hi I'm got the bow to shoot but I want it to add force over time like how it is in real life
public class Shoot : MonoBehaviour {
[SerializeField]
private GameObject arrow;
[SerializeField]
private Transform arrowSpan;
[SerializeField]
private float speed = 100f;
[SerializeField]
private float speedMutyPier = 2;
[SerializeField]
private float newSpeed;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetButtonDown("Fire1"))
{
// here is trying to add force over time
speed * speedMutyPier = newSpeed;
}
else if (Input.GetButtonUp("Fire1"))
{
Shooting();
}
}
void Shooting()
{
GameObject Clone = (GameObject)Instantiate(arrow, arrowSpan.position, arrowSpan.rotation) as GameObject;
Clone.GetComponent<Rigidbody>().AddForce(arrowSpan.forward * newSpeed);
}
}
Comment