Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Converting Bezier controller handles to x,y offsets

4 REPLIES 4
Reply
Message 1 of 5
tbttfox
471 Views, 4 Replies

Converting Bezier controller handles to x,y offsets

The values for tangent handles seem really arbitrary.

 

The docs say that the values "Control the absolute velocity at a key using the In/Out values"

 

So I checked a linear key at (24,1) at 24 fps in generic units. That's 1 unit movement over 1 second. It seems logical that the tangent value would be 1.

But we get 0.005.  Why????  Is there some scale factor of 1/200 just built in?

 

4 REPLIES 4
Message 2 of 5
klvnk
in reply to: tbttfox

 

for mxs this is the code i use for a bezier xyz position controller, hope it helps

 

fn GetOutY key next =
(
    len = key.outTangentLength ;
    if key.constantvelocity then
        len = [0.33333333,0.33333333,0.33333333];
    key.value + key.outTangent * len * ((next.time - key.time) as float) / (framerate);
    
)

fn GetInY key prev =
(
    len = key.inTangentLength;
    if prev.constantvelocity then
        len = [0.33333333,0.33333333,0.33333333];
    key.value + key.inTangent * len * ((key.time - prev.time) as float ) / (framerate);
    
)

 

Message 3 of 5
tfoxTD
in reply to: klvnk

That works perfectly well for getting the Y value of the tangent handles.
How about the X? That's where my problem lies.
Message 4 of 5
klvnk
in reply to: tfoxTD

TangentLength (in or out) is always the proportion of the time between frames so x = TangentLength  * "numberofframesbetweenkeys"

 

from the mxs help....

 

.inTangentLength and .outTangentLength, (typically a fraction from 0 to 1) represent how long the handle is towards the adjacent key. For example, a value of 0.5 means the handle reaches halfway from the current key to the adjacent key, and a value of 1 reaches all the way. If the handle reaches beyond the adjacent key, it will be greater than one. If there is no previous key, the value of .inTangentLength will be -1.

Message 5 of 5
tfoxTD
in reply to: klvnk

Oops, I apologize, you are correct.  The Y value was the problematic one. I was a bit distracted when I looked at that and got the values mixed in my head. Especially because that code was stupidly straightforward, I thought it was the X.

 

Thanks, it is exactly what I was looking for.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report