First Steps - Walk Down Stairs Script


https://forum.reallusion.com/Topic442018.aspx
Print Topic | Close Window

By videodv - 5 Years Ago
Hi All

After thinking about this for a while and after a recent challenge about walking down stairs I have had a play around and come up with this.
Keep in mine this is a very early example and I have lots more to do but I thought I would post and hopefully get some feedback.



Chris.
By Rampa - 5 Years Ago
Nice Chris! :)

What a wonderful start. She hits each step just right. It looks like the trailing leg starts lifting before the leading leg is fully planted on the next lower step. Maybe that could become a variable at some point.
By toystorylab - 5 Years Ago
Not sure what I am looking at...
As you say "script", does that mean it automatically fits to different Stair-"Terrains"?

By 4u2ges - 5 Years Ago
If it is what I think it is, then it's awesome!
So you scripted a step clip and then looped it. Right?
With right GUI, it can be used to generate walk upstairs, downstairs and just general walk loops I suppose.
By Rampa - 5 Years Ago
It made me think of the bone offset amount controls in the Motion Puppet and Motion Modify that let you adjust how much the joints rotate. So you can decrease or increase the rotation to adjust stride length.

But I like it. :)
By videodv - 5 Years Ago
toystorylab (4/18/2020)
Not sure what I am looking at...
As you say "script", does that mean it automatically fits to different Stair-"Terrains"?



Hi

The script is another name for a plugin
If I can complete this it will allow you to walk your charater up or down stairs with ease.
This plugin dos'nt use terrains.

Chris.

By videodv - 5 Years Ago
4u2ges (4/18/2020)
If it is what I think it is, then it's awesome!
So you scripted a step clip and then looped it. Right?
With right GUI, it can be used to generate walk upstairs, downstairs and just general walk loops I suppose.


Hi

Not really it creates its own full clip so no looping?
As you can see from the ealry ui I have inclided various options including up and down stairs.


https://forum.reallusion.com/uploads/images/9eeea951-1ae9-4bb6-bdd5-723e.jpg

Chris.
By videodv - 5 Years Ago
Rampa (4/18/2020)
It made me think of the bone offset amount controls in the Motion Puppet and Motion Modify that let you adjust how much the joints rotate. So you can decrease or increase the rotation to adjust stride length.

But I like it. :)


Hi

I have included a riser and step offset so you can place a foot where it needs to be.

Chris.

By videodv - 5 Years Ago
Here's a quick screen grab


Please keep in mind this is at a very early stage so not sure whats in or out at the moment.

Chris.
By Rampa - 5 Years Ago
Thanks for sharing the UI. I think you may have found a solution that can apply to more than just stairs! :)

Can the rise offset be adjusted so she just walks level, like for stepping stones?
By 4u2ges - 5 Years Ago
Great! I'll be watching the progress.

I wonder what would happen if you apply a terrain for stairs.
By toystorylab - 5 Years Ago
Wow, that looks very interesting, glad you share your results
and will certainly be happy to buy a working "stairwalker"-plugin!
By videodv - 5 Years Ago
I am hopeing to get the up down algorithm locked down over the next few days so I can start to look at how to use this in our scenes.
i.e incorpate it with existing paths or walk cycles or do I work out one for myself?
Extend it so you can walk backwards or "silly walks" ec
But first I must get the basics right then look at other options

Chris.
By AlbinosGambit - 5 Years Ago
Wow! Great work so far, hope you will finish this to share with the community:-) Appreciate your hard work. 

I don't know how you do it, but I am glad that someone knows and has the skills to create a script.

I know its early stages, but I suppose the "robotic" steps will be gone after you finish?

Keep up the good work, THANKS so far!:):):):):):)

videodv (4/18/2020)
Here's a quick screen grab


Please keep in mind this is at a very early stage so not sure whats in or out at the moment.

Chris.


By AlbinosGambit - 5 Years Ago
I second that, I will definitively buy a working plugin as well! :):):):):)

toystorylab (4/19/2020)
Wow, that looks very interesting, glad you share your results
and will certainly be happy to buy a working "stairwalker"-plugin!


By videodv - 5 Years Ago
Thanks Guys for your kind words

Please keep in mind this is very much in its early stages.

Anyway as far as the "robotic steps" are concerned I have made an adjustment and this is the first early test, as you can see I have also used two different types of steps as well.



I am currently working on the default speed of going down the stairs as well as better leg movments, this will take some time as I have got to collect all the data for the limbs.

Yes I know I am using the riser offset to change the slope of the stairs this was just me putting a variable in the wrong place and the result you can see so I will add a slope option to the ui, funny how some times a small mistake has an unintended but better outcome :)

If I can get this plugin to work correctly I will put it up for free as I have had a lot of help from the community so just a little thanks from me.

Chris.
By Rampa - 5 Years Ago
Hi Chris,

Very cool plugin you're making. Fun to see the updates! :)

I thought that perhaps an option to specify whether the first step is with the right or left foot would be helpful for matching to existing motions of the character walking to the stairs. It's hard to predict if the last step before the stairs will be the left or right foot.
By videodv - 5 Years Ago
Rampa (4/22/2020)
Hi Chris,

Very cool plugin you're making. Fun to see the updates! :)

I thought that perhaps an option to specify whether the first step is with the right or left foot would be helpful for matching to existing motions of the character walking to the stairs. It's hard to predict if the last step before the stairs will be the left or right foot.


Thanks Rampa

I was thinking the same thing as well, I took it out of the first ui but I think I will put it back in :)

Chris


By videodv - 5 Years Ago
Rampa (4/18/2020)
Thanks for sharing the UI. I think you may have found a solution that can apply to more than just stairs! :)

Can the rise offset be adjusted so she just walks level, like for stepping stones?


Hi Rampa

Once I have the basics sorted will explore other options but I dont see why not.

Chris.

By videodv - 5 Years Ago
Hi

Just re-ordered the ui I think this looks better but will proberbly change at some point.

https://forum.reallusion.com/uploads/images/63415bb9-4741-4be6-b349-7703.jpg

Chris.
By Eric C (RL) - 5 Years Ago
videodv (4/22/2020)
Hi

Just re-ordered the ui I think this looks better but will proberbly change at some point.

https://forum.reallusion.com/uploads/images/63415bb9-4741-4be6-b349-7703.jpg

Chris.

Hi Chris,

The UI looks nice! Just a small suggestion here.
Can we add a small title here to indicate the saving of the animation? (circled in blue)
Thanks and can't wait for the coming of your plugin =)
https://forum.reallusion.com/uploads/images/115b7ba6-b39a-48b5-9f2a-2a2d.png
By videodv - 5 Years Ago
Eric C (RL) (4/22/2020)
videodv (4/22/2020)
Hi

Just re-ordered the ui I think this looks better but will proberbly change at some point.

https://forum.reallusion.com/uploads/images/63415bb9-4741-4be6-b349-7703.jpg

Chris.

Hi Chris,

The UI looks nice! Just a small suggestion here.
Can we add a small title here to indicate the saving of the animation? (circled in blue)
Thanks and can't wait for the coming of your plugin =)
https://forum.reallusion.com/uploads/images/115b7ba6-b39a-48b5-9f2a-2a2d.png


Hi Eric
Ops forgot to put it in.
Chris
By AlbinosGambit - 5 Years Ago
Excited to see the results you come up with!

videodv (4/22/2020)
Eric C (RL) (4/22/2020)
videodv (4/22/2020)
Hi

Just re-ordered the ui I think this looks better but will proberbly change at some point.

https://forum.reallusion.com/uploads/images/63415bb9-4741-4be6-b349-7703.jpg

Chris.

Hi Chris,

The UI looks nice! Just a small suggestion here.
Can we add a small title here to indicate the saving of the animation? (circled in blue)
Thanks and can't wait for the coming of your plugin =)
https://forum.reallusion.com/uploads/images/115b7ba6-b39a-48b5-9f2a-2a2d.png


Hi Eric
Ops forgot to put it in.
Chris


By Rampa - 5 Years Ago
So is Jade being cooperative about these stairs?
By videodv - 5 Years Ago
Rampa (5/5/2020)
So is Jade being cooperative about these stairs?


Hi Rampa



This is where I got to when Iclone decided to play up so taking a little time out of Iclone to let my temperature cool down.

The problem I am now having is the step width and riser hight, on normal stairs they the same, but no matter what value I set a variable to place the feet in the correct place it will not work? not sure why yet but still waiting for RL to get back to me in the feedback tracker on my last question.

Stay safe.
Chris.
By Rampa - 5 Years Ago
That is a much smoother motion though! 
Try enabling foot contact, maybe?
By videodv - 5 Years Ago
Rampa (5/5/2020)
That is a much smoother motion though! 
Try enabling foot contact, maybe?


HI Rampa
Nope foot contact has no effect.

Just wondering if when placing the keys they should be in either local or world co_ordinates?

Chris.

By videodv - 5 Years Ago
Had a quick re_jiggle with the ui.

https://forum.reallusion.com/uploads/images/abe15f21-857d-4b82-96da-a707.jpg

Chris.
edited to correct spelling mistake on the ui :blush:
By Lord Ashes - 5 Years Ago
This is very impressive. I'm just starting out trying to make some Python scripts and I can't seem to find any script examples of simple bone manipulation (i.e. rotation). Your script obviously works with bones. Would you be able to post a small portion of your script (or a sample) of what needs to be done to manipulate a selected Avatar's bones? I posted this as a question in the forum but no one is answering.
By Eric C (RL) - 5 Years Ago
Hi @Lord Ashes,

Thanks for reply and we are calling some help now.
We will get back to you soon!

Eric 
By videodv - 5 Years Ago
Lord Ashes (9/28/2020)
This is very impressive. I'm just starting out trying to make some Python scripts and I can't seem to find any script examples of simple bone manipulation (i.e. rotation). Your script obviously works with bones. Would you be able to post a small portion of your script (or a sample) of what needs to be done to manipulate a selected Avatar's bones? I posted this as a question in the forum but no one is answering.


Hi Lord Ashes

Here is a snippet that shoud get you going.

import math, RLPy

#-- Get Characters from current scene --#
avatar_list = RLPy.RScene.GetAvatars()
#-- Get First Character --#
avatar = avatar_list[0]

#-- Get Motion Bone Data --#
motion_bone = avatar.GetSkeletonComponent().GetMotionBones()
    
#-- Get First Clip --#
animation_clip = avatar.GetSkeletonComponent().GetClip(0)
#-- Extend the Clip length --#
#animation_clip.SetLength(RLPy.RTime(5000))

time = RLPy.RGlobal_GetTime()

#-- Find head bone --#
for bone in motion_bone:
    if bone.GetName() == "RL_Head":
        #-- Get Key from Layer --#
        head_control = animation_clip.GetControl("Layer", bone)
        data_block = head_control.GetDataBlock()
        float_control_rotate_x = data_block.GetControl("Rotation/RotationX")
        #-- Set Key in current time to rotate the head bone to 90 degree --#
        float_control_rotate_x.SetValue(time, math.radians(45))
        
    if bone.GetName() == "RL_L_Thigh":
        #-- Get Key from Layer --#
        head_control = animation_clip.GetControl("Layer", bone)
        data_block = head_control.GetDataBlock()
        float_control_rotate_x = data_block.GetControl("Rotation/RotationX")
        #-- Set Key in current time to rotate the head bone to 90 degree --#
        float_control_rotate_x.SetValue(time, math.radians(-45))
        
    if bone.GetName() == "RL_L_Calf":
        #-- Get Key from Layer --#
        head_control = animation_clip.GetControl("Layer", bone)
        data_block = head_control.GetDataBlock()
        float_control_rotate_x = data_block.GetControl("Rotation/RotationX")
        #-- Set Key in current time to rotate the head bone to 90 degree --#
        float_control_rotate_x.SetValue(time, math.radians(-40))
    # if bone.GetName() == "RL_L_Foot":
        # #-- Get Key from Layer --#
        # head_control = animation_clip.GetControl("Layer", bone)
        # data_block = head_control.GetDataBlock()
        # float_control_rotate_x = data_block.GetControl("Rotation/RotationX")
        # float_control_rotate_x = data_block.GetControl("Position/PositionX")
        # #-- Set Key in current time to rotate the head bone to 90 degree --#
        # float_control_rotate_x.SetValue(RLPy.RGlobal.GetTime(), math.radians(-15)) #RLPy.RVariant(35) math.radians(-45)

        
# avatar_list = RLPy.RScene.GetAvatars()
# avatar = avatar_list[0]

# Motion Bone: RL_L_Calf
# Motion Bone: RL_L_Toe
# Motion Bone: RL_Spine02
# Motion Bone: RL_L_Clavicle
# Motion Bone: RL_L_Thigh
# Motion Bone: RL_Waist
# Motion Bone: RL_Pelvis
# Motion Bone: RL_R_Toe
# Motion Bone: RL_Head
# Motion Bone: RL_Hips
# Motion Bone: RL_R_Thigh
# Motion Bone: RL_L_UpperArm
# Motion Bone: RL_L_Foot
# Motion Bone: RL_L_Finger42
# Motion Bone: RL_R_Clavicle
# Motion Bone: RL_R_UpperArm
# Motion Bone: RL_R_Forearm
# Motion Bone: RL_R_Hand
# Motion Bone: RL_R_Calf
# Motion Bone: RL_R_Foot
# Motion Bone: RL_Neck
# Motion Bone: RL_L_Forearm
# Motion Bone: RL_Spine01
# Motion Bone: RL_L_Hand

you can also follow this link here

Hope all goes well
Chris

By animagic - 4 Years Ago
I was looking for a walking up/down stairs animation and even though there is now one in ActorCore it is not adjustable and also there is only a female version...:unsure:

So I was wondering what happened to your script. It doesn't seem that it was ever published?
By videodv - 4 Years Ago
Hi Animagic

While I did get the script to work with my own stairs mesh I could not get it ti work with other generic stairs as I kept getting a creeping error with the functions used to move the character that I could not resolve, Every now and then I have a fresh look at this but no luck yet, so its on the backburner for now.

Chris.
By animagic - 4 Years Ago
Thanks for your efforts anyway. Hopefully iClone 8 will make it easier or have it built in.

Motion clips are not really suitable because of the various dimensions of stairs.
By 4u2ges - 4 Years Ago
I still hope you make this one day, videodv :)

Meantime I have made this tutorial a long time ago (someone might remember a couple of long threads about walking down).
It's about animating a basic loop manually with the help of Pose Manager plug-in. Pretty much labor intense and I was too lazy to comment it :Whistling:
But following it (given you have an even set of stairs converted to terrain), you may built your own walking down loop and multiply it.