How to animate feet (scripting) and have ground move same speed (no slipping)?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Search this Thread Display Modes
Old 02 February 2017   #1
How to animate feet (scripting) and have ground move same speed (no slipping)?

Hello all!

I am working on a project where I have to script the animation of a quadruped walk and run cycle. The walk cycle isn't hard, with a sin function for up and down motion and cos or -cos for the forward and back motion. Yet I don't get how to make the ground move with the feet at the exact speed they are moving. After all, if I assign a sin or cos function to the ground it will move back and forth, as it goes from 1 to -1 and back in a cycle.


Here is my code so far:

Quote: $amp = 2; //controls height of foot during animation
$ampz = 3; //controls forward and back motion of foot during animation

if(frame < 100) //speed up for 100 frames then stop, as a test to see the code is working
$speed = 3+time*2;
else
$speed = 0; //this is to just test if they object will stop at frame 100, will later add in whatever the heck slows it down.

$footmove = $ampz*cos($speed*time); //front foot
$footmove2 = $ampz*cos($speed*time+3.14); //back foot
$footup = $amp*sin($speed*time); //front foot y motion
$footup2 = $amp*-sin($speed*time); //back foot z motion

foot.translateX = $footmove;
if($footup >= 0)
foot.translateY = $footup;
else
foot.translateY = 0;

foot2.translateX = $footmove2;
if($footup2 >= 0)
foot2.translateY = $footup2;
else
foot2.translateY = 0;

ground.rotateZ = -1*($amp*$speed*time*.43);
/*ground object rotation (huge cylinder on side, so it can rotate and close up it looks flat*/
 
Old 03 March 2017   #2
this code for which game can you post more info than i can solved your problem
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 03:51 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.