Locomotion: changing the duration of the walk/run (frames)

Greetings l. I walk to make the walking/ running longer (not just 100 frames) and I thought that by using thw duration option, it would make it longer but apparently I makes the simulation longer but not the walinking/ running longer. Any ideas?
Thank you in advance

Giving the simulation more time does not affect the steps you’ve already drawn. More time needs more steps.

I think what you were expecting is to stretch the existing steps as you increase the duration, we’ve thought about this too and it would be useful. It could be achieved via Python like this.

from ragdoll.vendor import cmdx

def scale_plan(plan, duration=100):
    """Scale step sequence of each foot in `plan` to new `duration`
    
    Arguments:
        plan (rdPlan): Plan to adjust
        duration (int): New duration for plan

    """
    
    # Determine scale factor
    old_duration = plan["duration"].read()
    scale = duration / old_duration
    print("Scaling '%s' from %d -> %d (%.2fx)" % (
        plan, duration, old_duration, scale)
    )

    with cmdx.DagModifier() as mod:
        # Update the duration of the plan
        mod.set_attr(plan["duration"], duration)
    
        # Next, scale the step sequence of each foot
        for element in plan["inputStart"]:
            foot = element.input()
            sequence = foot["stepSequence"].read()
            scaled_sequence = []
            
            for i in range(duration):
                # Find index in original sequence
                orig_index = int(i / scale)
                scaled_sequence.append(sequence[orig_index])
            
            # Update foot
            mod.set_attr(foot["stepSequence"], scaled_sequence)
    
    # Trigger evaluation of new plan
    plan["startState"].read()
    
    print("Success")


sel = cmdx.selection()
if not sel:
    print("Select rdPlan")
else:
    plan = sel[0]
    if plan.is_a(cmdx.kTransform):
        plan = plan.shape(type="rdPlan")
    
    if plan is None:
        print("Selection was not a rdPlan")
    
    else:
        scale_plan(plan)
1 Like

Thank you very much. it was extremely helpful !!!

1 Like