Basically, this is what I'm trying to acheive in its simplest form.

Does anyone know how to change sin/cos in this way? I just require them to linearly increase/decrease over the set amount of time set on the x axis.

In case of the link not working, these are the kinds of values I require:
x=0, y=0;
x=0.1, y=0.1;
x=0.9, y=0.9;
x=1.1 y=0.9;
x=1.9 y=0.1;
x=2.1 y=-0.1;
x=2.9 y=-0.9;
x=3.1 y=-0.9;
x=3.9 y=-0.1;
x=4.0 y=0;

So when y == 1, reverse the sign
When y == -1, reverse it again.

So when y == 1, reverse the sign
When y == -1, reverse it again.

Well, it's possible to add a couple of if statements to make the thing work but when working with 3 axis of movement, all of which effect each other, I'd end up with 27 if statements instead of 3 formulas; I'm not one for taking the easy route, especially as in this case, there is a huge performance drop-off in doing so.

I was just wondering as the lines of my graph loosely follow the patterns of sine/cosine, whether there is a mathematical function to multiply the resulting sine/cosine values, in order to make them follow a linear path between the cap values at 1 and -1. There must be something to do this...

Yeah there's something alright.
But you're not going to like it.

> especially as in this case, there is a huge performance drop-off in doing so.
An if statement is as basic as it gets.

27?
I count 6 (two for each axis)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.