Dynamic coordinates

Hello together,

I need your help.
The idea is this to import a prepared model (golf player). I get dynamic coordinates from the backend (from time to time different coordinates will come). Coordinates are measured live from a person who strikes with a stick (golf game).
The problem is that I substitute these coordinates into my model in babylon.js (I use this method - skeleton.bones [0] .setYawPitchRoll (y, x, z).
Please find examples -
Babylon.js Playground 7571PE # 78
CharacterController Demo

However, the model behaves strangely - the movements are curved and do not correspond to reality.

Is it possible to somehow exclude the hierarchy of bones? Is it possible to implement the idea of ​​transmitting dynamic coordinates for the model. What do you need for this?

Thank you

Hello and welcome to the Babylon community!
It’s definitely possible to receive the coordinates of a model dynamically. There might be a variety of reasons for strange behavior, maybe the equipment which is getting the coordinates is wrongly calibrated, or data is arriving in a unexpected order, or in a unexpected format, etc. I recommend simplifying the problem - try modeling an arm first, instead of an entire body - it’s easier finding the issue this way.

I modified one of the bone sample playgrounds to show that you can receive some rotations for a bone and apply them: [aa | Babylon.js Playground (babylonjs.com)] (https://playground.babylonjs.com/#D4ZZ8#207) - here I’m just cycling through a list of arbitrarily defined coordinates and applying their values to the bones, I defined my coordinates as a list, where each entry on the list is another list of Vector3 values - each Vector3 corresponds to the rotation values in one bone. But the coordinates you receive from your backend will probably be in a different format, so you’ll need some kind of processing.

1 Like

Hello, thanks for replying. Thanks for your time for this.
Coordinates are calibrated on special equipment.
I trying to apply coordinates using Vector3 as you showed me on example. It did not helped.

Maybe the case is that my model in babylon.js and person that is filmed (from whom coordinates are taken) have different height?
You showed me example with rotating oly one bone. I have already seen those in babylon documentation. But, unfortunately I did not find any examples of animating model with full dynamic coordinates . All examples are with impoted model that has predefined animation (prepared in Blender as I understand). Are there any examplse relevant to my case?

perhaps I am wrong, could you please tell if hierarchy of bones can hav impact on my person’s behaviour?
Thank you very much in advance.
Thank you for spending time on reading this. It is realy very important to me right now.

Hello and welcome again!

problems with height differences

I doubt that’s your issue, given what I can see in your character controller demo. I would hazard that the coordinate indices aren’t matching up correctly - are you transforming the incoming coordinates to bone local space or are the Vector3 bone rotations in some other space, like mesh or even world?

Actually I have a better theory (I’ll leave the above for posterity) - The applied animation appears to favor the -y/+x axis - did you know that BabylonJS uses a left-handed coordinate system? Make an ‘L’ with your left hand. Your index finger points in the +y axis, while your thumb points orthogonally in the +x axis. Stick your middle finger out perpendicular to both thumb and index finger and you’re pointing it in the +z axis.

Many modeling and 3D software packages invert the z- or y- axis or otherwise express coordinates differently - you’ll want to check your data to see how it is projected to determine how to transforming those points before applying them to the skeleton

HTH

3 Likes

Hi!
I think another question here is whether your dynamic coordinates are in absolute values and all bones are at the top level or whether they are parented? Maybe you could just start by debugging only one bone, for example the head so it is much more easier to spot an issue visually.

2 Likes