About Store Forum Documentation Contact



Post Reply 
Lerp method suggestion
Author Message
JonathonA Offline
Member

Post: #1
Lerp method suggestion
I was wondering if it would be possible for Lerp methods to return perhaps true or false when they have completed or some form of signal to indicate completion?
04-09-2012 03:54 PM
Visit this user's website Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #2
RE: Lerp method suggestion
You actually control when a lerp "completes" based on the step you pass it. You can consider a lerp to be complete when the step = 1. So just check the step when calling Lerp().
04-09-2012 04:37 PM
Find all posts by this user Quote this message in a reply
JonathonA Offline
Member

Post: #3
RE: Lerp method suggestion
Right okay thats assuming I am using LerpR but I am actually using just Lerp at the moment.
(This post was last modified: 04-09-2012 11:37 PM by JonathonA.)
04-09-2012 10:53 PM
Visit this user's website Find all posts by this user Quote this message in a reply
PsychoBoy Offline
Member

Post: #4
RE: Lerp method suggestion
For Lerp its the same, for example:
Code:
for(flt step=0.1f; step<=1.0f; step+=0.1f)
{
      Flt out = Lerp(1, 10, step);
      if(step == 1)
      {
          //if we're here that means job is finished, because step = 1; and out = 10;
      }
}
(This post was last modified: 04-10-2012 01:43 AM by PsychoBoy.)
04-10-2012 01:42 AM
Visit this user's website Find all posts by this user Quote this message in a reply
JonathonA Offline
Member

Post: #5
RE: Lerp method suggestion
Hmm okay it won't achieve what I need it to but I have approached this problem in a wrong way maybe.

I need to smoothly transition the camera between two points at a constant rate. GetVel(...) can return the velocity and angular velocity between the two points for me but I can't set the Camera _vel or _ang_vel directly (since they are private) so I tried to interpolate between the dist, pitch, yaw and roll but it is very awkward.

Any suggestions?
04-11-2012 11:36 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply