Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

how get bow to add more force over time

$
0
0
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().AddForce(arrowSpan.forward * newSpeed); } }

Viewing all articles
Browse latest Browse all 1264

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>