Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class NewController : MonoBehaviour
- {
- public ConstantForce frc;
- [Range(0.1f, 5f)]
- public float verticalSensitivity = 1;
- [Range(0.1f, 5f)]
- public float horizontalSensitivity = 1;
- Rigidbody rig;
- // Use this for initialization
- void Start()
- {
- rig = GetComponent<Rigidbody>();
- }
- void Update()
- {
- frc.relativeTorque = new Vector3(Input.GetAxis("Mouse Y") * 100f * verticalSensitivity,
- Input.GetAxis("Horizontal") * 100f,
- -Input.GetAxis("Mouse X") * 100f * horizontalSensitivity)
- * Mathf.Clamp01(rig.velocity.magnitude / 100f);
- frc.relativeForce = new Vector3(0, 0, Mathf.Clamp(Input.GetAxis("Vertical"), -0.1f, 1f) * 1000f);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement