I am working with a skinned mesh of a 'snake' that I exported from Blender. This snake has bones resembling a spine that I want to animate along a curve called SplineCurve3.
While I can calculate points along the spline and the angles between those points, I am encountering difficulty in setting the rotations of the bones correctly.
The issue lies in the fact that each bone is a child of the previous bone, meaning that rotating one bone also affects the others in the chain.
In the image provided:
The outer shape represents the snake itself.
The pink line illustrates a section of a SplineCurve3.
The blue/green lines represent the bones (THREE.SkeletonHelper).
To rotate each bone, I am using SplineCurve3.getTangentAt function. However, due to the parent bone being rotated as well, the snake curls up instead of following the desired path outlined by the pink line.
My main query is how can I adjust for the rotation of the parent bone(s) when determining the rotation of an individual bone?
Furthermore, although the path shown in the image is flat, my ultimate aim is to move the snake in three dimensions - essentially turning it into a flying snake.