JavaScript THREE.js: making a skinned mesh follow a spline

I have a skinned mesh of a 'snake', exported from blender. The snake has bones (like a spine) which I want to animate along a curve (SplineCurve3)

I can calculate points along the spline, and the angles between those points, but I'm struggling setting the rotations of the bones correctly.

The problem is that each bone is a child of the previous bone, so rotating one also rotates the others.

Here's an image:

problem

The outer shape is the snake.

The pink line is a section of a SplineCurve3.

The blue/green lines are the bones (THREE.SkeletonHelper).

Each bone is rotated using SplineCurve3.getTangentAt. Because the parent is rotated too, the snake curls up. I basically need the bones to be where the pink line is.

How can I 'compensate' for the rotation of the parent(s) when calculating the rotation of a bone?

Also, in the image the path is flat, but my goal is to move the snake in 3 dimensions. It's a flying snake.

Answer:1

On my website I have a commenting form which tells you how long ago a comment was posted. Below is a code to reload only the span containing the date every 10 seconds, NOT the entire comments div (to ...

On my website I have a commenting form which tells you how long ago a comment was posted. Below is a code to reload only the span containing the date every 10 seconds, NOT the entire comments div (to ...

  1. using jquery ajax in react
  2. using jquery ajax with promise
  3. using jquery ajax to retrieve data from mysql
  4. using jquery ajax to retrieve data from mongodb
  5. using jquery ajax to populate select options
  6. using jquery ajax in django
  7. using jquery ajax
  8. using jquery.ajax to submit a form
  9. using jquery ajax to download a file
  10. using jquery ajax to post data
  11. using jquery ajax call
  12. delete using jquery ajax
  13. jquery and ajax
  14. jquery with ajax example
  15. jquery and ajax tutorial
  16. jquery with ajax cdn
  17. jquery and ajax interview questions
  18. jquery with ajax download
  19. jquery and ajax tutorial pdf
  20. jquery with ajax call example

Im trying to find a way to return information when placing an outgoing call through the twilio softphone in the browser. When I place an outgoing call my application invites the remote party to a ...

Im trying to find a way to return information when placing an outgoing call through the twilio softphone in the browser. When I place an outgoing call my application invites the remote party to a ...

I'm a bit new with JavaScript (learning from CodeCademy), and I was wondering why this was happening: function Person(job, married) { this.job = job; this.married = married; // add a "...

I'm a bit new with JavaScript (learning from CodeCademy), and I was wondering why this was happening: function Person(job, married) { this.job = job; this.married = married; // add a "...

  1. javascript sort different results
  2. javascript regex different results

Here's a script I'm using. $(window).load(function() { $('#edifici, #artistici, #industriale, #fotovoltaico, #veterinaria, #architettonici').hide(); if (!!window.location.hash) { var hash = ...

Here's a script I'm using. $(window).load(function() { $('#edifici, #artistici, #industriale, #fotovoltaico, #veterinaria, #architettonici').hide(); if (!!window.location.hash) { var hash = ...