CGTalk > Technical > Graphics Programming
Login register
reply share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 02-26-2017, 04:39 PM   #1
Join Date: Mar 2014
Posts: 4
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:

$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;
$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;
foot.translateY = 0;

foot2.translateX = $footmove2;
if($footup2 >= 0)
foot2.translateY = $footup2;
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-04-2017, 12:01 PM   #2
Join Date: Feb 2017
Posts: 20
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
Society of Digital Artists

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

All times are GMT. The time now is 11:31 PM.

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