• Advertisement
Sign in to follow this  

What kind of Inverse Kinematic is used here?

This topic is 2018 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi!
I'm going to code some 3d creatures like snakes or tentacles.
For inspiration i've looked for some code around on the net and i've found this one:
[url="http://www.openprocessing.org/sketch/8405"]http://www.openproce...org/sketch/8405[/url]
ok, i like it.

It is a simple structure: a list of nodes, the first node is the main direction, the other nodes follow the first in a fluid and
[left]wiggly way.[/left]


the algorithm is quite easy:

1 calculate the position of the head (the direction of the creature)
2 this procedure is used:




[source lang="java"]void move(float headX, float headY, float headZ) {

float dx, dy, dz, d;

// node 0: position, direction, orbiting handle
nodes[0].x = headX;
nodes[0].y = headY;
nodes[0].z = headZ;

// node 1: muscule
count += muscleFreq;
nodes[1].x = nodes[0].x ;
nodes[1].y = nodes[0].y + PApplet.sin(count) ;
nodes[1].z = nodes[0].z + PApplet.cos(count) ;

// apply kinetic forces down through body nodes
for (int i = 2; i < nodes.length; i++) {
dx = nodes[i].x - nodes[i - 2].x;
dy = nodes[i].y - nodes[i - 2].y;
dz = nodes[i].z - nodes[i - 2].z;

d = PApplet.sqrt(dx*dx + dy*dy + dx*dx) *ks;

float dx_d = + (dx * girth) / d;
float dy_d = + (dy * girth) / d;
float dz_d = + (dz * girth) / d;

nodes[i].x = nodes[i - 1].x +dx_d;
nodes[i].y = nodes[i - 1].y +dy_d;
nodes[i].z = nodes[i - 1].z +dz_d;
}
}[/source]

with girth as a random number near between 5 and 15 and muscleFreq between 0.1 and 0.2 i get nice results.

now, i understand that this is not the real inverse kinematics but.. if i check on google about IK i found a lot of maths and a lot of methods like angles, CCD, Jacobs..
my question is:
i just need to make wiggly creatures. what is this algorithm?
or even.. can you advice me some articles or other way to make chain snake-like creatures? Edited by nkint

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement