• Create Account

Banner advertising on our site currently available from just \$5!

### #ActualBrother Bob

Posted 22 July 2013 - 12:13 PM

You could use one of the great ones I think.   Good old mix(), A.K.A. lerp(). A.K.A. linear interpolation. A.K.A. key-frame animation.

Using the distance function: distance = positionB - PositionA and a bit of trig you can get the new angle to move towards.  Let's put the trig stuff off until we are both on the same page, for me I've just coded and tested the following and it's working as expected.  After this, the hard part....

//===========================================================================

blendedRotation = startRotation * (1.0 - sliderTime) + targetRotation * sliderTime;

//------------------------------------ then

if(sliderTime <= 1.0) // This will prevent the rotation from over-shooting

{

sliderTime += incrementTime;

}

//===========================================================================

We might have to throw a bit more logic to deal for cases where the various rotation values transition across 0.0.  i.e. 360 to 0.0 for the angle,  or positive to negative for the  X, Y, Z, axis values.  Math.h and its atan() function will deal with this stuff quietly behind the scenes.

I'm hesitant to throw down much code or ideas at this point without testing what I post, before I post it.  I've got a basic framework started that only has this stuff in it.  If you want to get a running dialogue going then I will keep working on this with you and I will only post code after I have tested it.

This issue is pretty important for many of us and I think with the help of others we should have this looking nice and clean and easy to use within a week or two.  I'll be shooting for high school level math to start with.  After that, we can work on implementing ideas presented by the slick math people that show up around here from time to time...if this suits you.

### #14marcClintDion

Posted 22 July 2013 - 03:12 AM

There is far too much arrogance and out right abuse by site moderators, they are teaching other people to behave this way.  The posts I've made will all be shorty removed and replaced with this notice.  Game development is not the only thing being taught here, bad behavior is being taught as well.

### #13marcClintDion

Posted 29 June 2013 - 08:26 AM

You could use one of the great ones I think.    Good old mix(), A.K.A. lerp(). A.K.A. linear interpolation. A.K.A. key-frame animation.

Using the distance function: distance = positionB - PositionA and a bit of trig you can get the new angle to move towards.  Let's put the trig stuff off until we are both on the same page, for me I've just coded and tested the following and it's working as expected.  After this, the hard part....

//===========================================================================

blendedRotation = startRotation * (1.0 - sliderTime) + targetRotation * sliderTime;

//------------------------------------ then

if(sliderTime <= 1.0) // This will prevent the rotation from over-shooting

{

sliderTime += incrementTime;

}

//===========================================================================

We might have to throw a bit more logic to deal for cases where the various rotation values transition across 0.0.  i.e. 360 to 0.0 for the angle,  or positive to negative for the  X, Y, Z, axis values.  Math.h and its atan() function will deal with this stuff quietly behind the scenes.

I'm hesitant to throw down much code or ideas at this point without testing what I post, before I post it.  I've got a basic framework started that only has this stuff in it.  If you want to get a running dialogue going then I will keep working on this with you and I will only post code after I have tested it.

This issue is pretty important for many of us and I think with the help of others we should have this looking nice and clean and easy to use within a week or two.  I'll be shooting for high school level math to start with.  After that, we can work on implementing ideas presented by the slick math people that show up around here from time to time...if this suits you.

### #12marcClintDion

Posted 29 June 2013 - 08:24 AM

You could use one of the great ones I think.    Good old mix(), A.K.A. lerp(). A.K.A. linear interpolation. A.K.A. key-frame animation.

Using the distance function: distance = positionB - PositionA and a bit of trig you can get the new angle to move towards.  Let's put the trig stuff off until we are both on the same page, for me I've just coded and tested the following and it's working as expected.  After this, the hard part....

//===========================================================================

blendedRotation = startRotation * (1.0 - sliderTime) + targetRotation * sliderTime;

//------------------------------------ then

if(sliderTime <= 1.0) // This will prevent the rotation from over-shooting

{

sliderTime += incrementTime;

}

//===========================================================================

We might have to throw a bit more logic to deal for cases where the various rotation values transition across 0.0.  i.e. 360 to 0.0 for the angle,  or positive to negative for the  X, Y, Z, axis values.  Math.h and its atan() function will deal with this stuff quietly behind the scenes.

I'm hesitant to throw down much code or ideas at this point without testing what I post, before I post it.  I've got a basic framework started that only has this stuff in it.  If you want to get a running dialogue going then I will keep working on this with you and I will only post code after I have tested it.

This issue is pretty important for many of us and I think with the help of others we should have this looking nice and clean and easy to use within a week or two.  I'll be shooting for high school level math to start with.  After that, we can work on implementing ideas presented by the slick math people that show up around here from time to time...if this suits you.

### #11marcClintDion

Posted 29 June 2013 - 08:23 AM

You could use one of the great ones I think.    Good old mix(), A.K.A. lerp(). A.K.A. linear interpolation. A.K.A. key-frame animation.

Using the distance function: distance = positionB - PositionA and a bit of trig you can get the new angle to move towards.  Let's put the trig stuff off until we are both on the same page, for me I've just coded and tested the following and it's working as expected.  After this, the hard part....

//===========================================================================

blendedRotation = startRotation * (1.0 - sliderTime) + targetRotation * sliderTime;

//------------------------------------ then

if(sliderTime <= 1.0) // This will prevent the rotation from over-shooting

{

sliderTime += incrementTime;

}

//===========================================================================

We might have to throw a bit more logic to deal for cases where the various rotation values transition across 0.0.  i.e. 360 to 0.0 for the angle,  or positive to negative for the  X, Y, Z, axis values.  Math.h and its atan() function will deal with this stuff nicely behind the scenes.

I'm hesitant to throw down much code or ideas at this point without testing what I post, before I post it.  I've got a basic framework started that only has this stuff in it.  If you want to get a running dialogue going then I will keep working on this with you and I will only post code after I have tested it.

This issue is pretty important for many of us and I think with the help of others we should have this looking nice and clean and easy to use within a week or two.  I'll be shooting for high school level math to start with.  After that, we can work on implementing ideas presented by the slick math people that show up around here from time to time...if this suits you.

### #10marcClintDion

Posted 29 June 2013 - 08:21 AM

You could use one of the great ones I think.    Good old mix(), A.K.A. lerp(). A.K.A. linear interpolation. A.K.A. key-frame animation.

Using the distance function: distance = positionB - PositionA and a bit of trig you can get the new angle to move towards.  Let's put the trig stuff off until we are both on the same page, for me I've just coded and tested the following and it's working as expected.  After this, the hard part....

//===========================================================================

blendedRotation = startRotation * (1.0 - sliderTime) + targetRotation * sliderTime;

//------------------------------------ then

if(sliderTime <= 1.0) // This will prevent the rotation from over-shooting

{

sliderTime += incrementTime;

}

//===========================================================================

We might have to throw a bit more logic to deal for cases where the various rotation values transition across 0.0.  i.e. 360 to 0.0 for the angle,  or positive to negative for the  X, Y, Z, axis values.  Math.h and its atan() function will deal with this stuff nicely without any messiness.

I'm hesitant to throw down much code or ideas at this point without testing what I post, before I post it.  I've got a basic framework started that only has this stuff in it.  If you want to get a running dialogue going then I will keep working on this with you and I will only post code after I have tested it.

This issue is pretty important for many of us and I think with the help of others we should have this looking nice and clean and easy to use within a week or two.  I'll be shooting for high school level math to start with.  After that, we can work on implementing ideas presented by the slick math people that show up around here from time to time...if this suits you.

PARTNERS