Problem with Mathf.Sin
Hello, I have a problem with Sin in Unity, I`ve done this in Maya or even in Java, I can`t set the amplitude or the frequency of the Sin function, I want an object to move certain units and return to his original position, with transform.Translate should be alright.
(moveTo) that would be my amplitude and I want to be able to control it`s speed (speedSide2Side) that would be my frequency, but somehow is not happening that.
var moveTo : int = 1;
var speedSide2Side : float = 2;
function Update(){
transform.Translate (Vector3.right*((Mathf.Sin(Time.time*speedSide2Side)*moveTo))*Time.deltaTime);
}
Comment