I’m looking to build a custom cursor that changes appearance and travels through walls etc, but am stuck at achieving proper acceleration. Multiplying the mouse input vector by itself wields it very erratic, even if I only use 20%.
public float spd = 0.5F;
public float acc = 0.2F;
float h = Input.GetAxis ("Mouse X");
float v = Input.GetAxis ("Mouse Y");
if (h!=0){
if (v!=0){
transform.Translate (new Vector3 (h*acc, v*acc) * spd);}
}}
Also tried adding rigidbody force, but no change at all:
Rigidbody rig;
void FixedUpdate () {
Vector3 mouseDelta = new Vector3( Input.GetAxis("Mouse X") , Input.GetAxis("Mouse Y"), 0f ) * s;
rig.AddForce(mouseDelta * rig.mass * Time.deltaTime);
}
If anyone can provide tips, it’s been bugging me all day, thanks.