How would I convert this into Javascript.
Right now this work inside of 3ds Max as is.
the number 12 references to 12 frames a second. So the for loop goes frame by frame.
the number 20 refers to how high on the y position the object will go at it’s peak
for i = 0 to 12 do
(
y = abs(sin(180.0*i/12))*20.0
)
In unity I’m not sure how to right it out since there is the time.deltaTime thing.
For my case I want the arc to take course of the life of 2 seconds.
My attempt in javascript
private var counter = 0.0;
function Start () {
InvokeRepeating("IncreaseCounter", 1.0, 1.0); //adds X to 'counter' each second
}
function IncreaseCounter () {
counter += 1.0;
}
function Update () {
stepY = ( Mathf.Abs( Mathf.Sin(180.0*counter / Time.deltaTime)) * 5.0);
transform.position.y = stepY;
}