Search code examples
swiftscenekitgame-physicsarkitquaternions

Hair bouncing bones in SceneKit


I'm developing a game in SceneKit (iOS 13) and I want to add realism to the movements of the character.

The character has hair with a skeleton-bones, so I can make it bounce programmatically. I want to rotate the bones in a natural way so the hair bounces.

What's the best approach for this? As soon as there is no-movement, I want the bones to return to the original position.

Here is a reference of how bones are placed:

Image does not belong to me, just using it as reference


Solution

  • After some research and surfing the web I found an example of exactly what I want to achieve, and it's called: Inverse Kinematics

    Hope it helps anyone who wants to achieve this. Here is a GitHub repo I found by Robert-Hein Hooijmans.

    https://github.com/roberthein/InverseKinematics

    enter image description here

    (I don't know why it got -1. Either I didn't explain myself correctly or people are being subjective. Yes it's a rant.) (If anyone here can tell me the reason they think it got -1, let me know!, I'm here to learn how to post)