/*cgm_quat grot = {0, 0, 0, 1};*/
float grot_theta, grot_phi;
float ginner_xform[16], gouter_xform[16];
/*cgm_quat grot = {0, 0, 0, 1};*/
float grot_theta, grot_phi;
float ginner_xform[16], gouter_xform[16];
/* create a rope hanging from the anchor point */
if(!(rope = rsim_alloc_rope(ROPE_MASSES, ROPE_SPRINGS))) {
fprintf(stderr, "failed to allocate rope\n");
return -1;
}
for(j=0; j<ROPE_MASSES; j++) {
/* create a rope hanging from the anchor point */
if(!(rope = rsim_alloc_rope(ROPE_MASSES, ROPE_SPRINGS))) {
fprintf(stderr, "failed to allocate rope\n");
return -1;
}
for(j=0; j<ROPE_MASSES; j++) {
- rope->masses[j].p = ganchor[i];
- rope->masses[j].p.y = ganchor[i].y - j * ROPE_LEN / ROPE_SPRINGS;
+ float t = (float)j / (float)(ROPE_MASSES - 1.0f);
+ cgm_vlerp(&rope->masses[j].p, ganchor + i, manchor + i, t);