How to Increase Height of Pendulum?

Hey everybody.

I have a pendulum that swings back and forth.

I want to add height on each pass of the pendulum. I thought that it would be as easy as adding to the angle on each pass, but this doesn’t work.

The pendulum remains swinging the same.

public float angle=40.0f;
transform.rotation=Quaternion.Lerp(qStart,qEnd,(MathF.Sin(Time.time*speed)+1.0f)/2.0f);

Code is not mine and it was found here on Answers.

I want to add about 10 or 15 degrees to the swing on each pass.

Any ideas on how to do this?

Thanks in advance.

In the line

Quaternion.Lerp(qStart,qEnd,(MathF.Sin(Time.time*speed)+1.0f)/2.0f)

qStart and qEnd are your beginning and end angles.
The rest is how it calculates where it is between them.

You should be able to change the swing by making those two variables further apart.
I would try to just add a tiny bit to one and subtract a tiny bit from the other over time.

void Update(){
    qStart -= Time.deltaTime;
    qEnd += Time.deltaTime;
}

To be precise you could check for every time it reaches one side and add 10 degrees to the other. I think this might end up looking very unnatural though.

void Update(){
   if(qStart - (MathF.Sin(Time.time*speed)+1.0f)/2.0f) < 0.01f) //very close to start
        qEnd += 10.0f;
   else if(qEnd - (MathF.Sin(Time.time*speed)+1.0f)/2.0f) < 0.01f) //very close to end
        qStart -= 10.0f;
}