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

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*/

 03 March 2017 #2 divitorobert Explorer portfolio   Join Date: Feb 2017 Posts: 20 this code for which game can you post more info than i can solved your problem share quote

 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 vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.