|
|
Hi Tor,
Thanks again for helping me. I think either I didn't
explain my needs correctly, or I don't understand
how to implement your suggestions for my case.
Here's my scenario:
I have 62 meters over which I must move an object.
It is currently moving at 1 meter per sec.
I want to come to a complete stop when I get to 62 meters.
I want to gradually slow down for the duration of those 62 meters.
I have no idea how many steps it will take.
The magic number for this example is about 0.008009
As I subtract the magic number from the current
increment value (starting at 1), when I reach the 62
meter mark, the increment value is very close to 0.
Code snippet kluge:
================================
#declare len = 62;
#declare inc = 1;
#declare currpos = 0;
#declare incChg = 0.008009; // how do I calculate this number?
#declare nStepCt = 0;
#while (currpos <= len & inc >= incChg)
#debug concat("CurrPos: ",str(currpos,0,-1)," Inc: ",str(inc,0,-1),"\n")
#declare inc = inc - incChg;
#declare currpos = currpos + inc;
#declare nStepCt = nStepCt + 1;
#end // while
#debug concat("Steps: ",str(nStepCt,0,-1)," incChg: ",str(incChg,0,-1),"\n")
==================================
This takes 124 steps to complete.
How do I calculate the value of "incChg" ?
Maybe there's a better way to do this?
Thanks again for your kind help...
=Bob=
Post a reply to this message
|
|