Hi, further to my other thread regarding force movement : -
using UnityEngine;
using System.Collections;
public class PushMe : MonoBehaviour {
void OnMouseUp() {
GetComponent<Rigidbody>().AddForce(-transform.forward * 1000);
GetComponent<Rigidbody>().useGravity = true;
}
}
I’d like some help in reworking this script so that I can actually ‘charge’ my gameObject, so depending on how long I have the mouse button down before releasing, it actually increases the force ( to a maximum level ) before releasing the mouse and moving the gameObject forward at the chosen force speed.
Brownie points for even more control, i.e. move mouse forward or backwards to control force amount, not just charge until maximum force is hit !
Thanks