float amount = 0.055f;
public float maxAmount = 0.09f;
float smooth = 3;
Vector3 def;
Vector2 defAth;
Vector3 euler;
GameObject ath;
AudioSource audioArmsMove;
void Start()
{
def = transform.localPosition;
euler = transform.localEulerAngles;
audioArmsMove = gameObject.GetComponent<AudioSource>();
}
float _smooth;
// Update is called once per frame
void Update()
{
_smooth = smooth;
float factorX = -Input.GetAxis("Mouse X") * amount;
float factorY = -Input.GetAxis("Mouse Y") * amount;
if (factorX > maxAmount)
factorX = maxAmount;
if (factorX < -maxAmount)
factorX = -maxAmount;
if(factorY > maxAmount)
factorY = maxAmount;
if (factorY < -maxAmount)
factorY = -maxAmount;
Vector3 final = new Vector3(def.x + factorX, def.y + factorY, def.z);
transform.localPosition = Vector3.Lerp(transform.localPosition, final, Time.deltaTime * _smooth);
}
Ak0rn
2
Not sure if it would work as I’ve never tried but you could have a Vector3 of currentCamPos inside of update which will constantly look at the cameras current position and a lateupdate Vector3 of prevCamPos then a vector3 distance inside of update to check if the two don’t match and if they don’t then you play sound.
No clue if it’ll work but worth a try.
In the Update method, create an if statement checking for input.getaxis on mouse x OR mouse y, if its true, play the cloth sound, else return.