I've got an application where I'm trying to showdisplay an object in 3D, with information provided by real-world accelerometers and inclinometers - sensors that pick up the angle of the equipment relative to ground, relative to ground.
The trouble comes from when I want to show this 'world pitch' or 'world roll' on an object that is a child of another.
I'd think that there is a trivial solution to the problem...but I can't, but for the life of me, I can't figure out what it is.
Let's say I've got a robot arm with several pieces - "LowerArm", "Elbow", "UpperArm" and "Hand". The hand"Hand" is the child of the UpperArm"UpperArm", Upperarmand "UpperArm" is the child of the Elbow etc"Elbow".
What I'd like to do is place 'hand'"Hand" at 0 degreesdegree pitch relative to world-space, relative to world-space, no matter how I move the parent objects. So ifIf I grab my "LowerArm", and rotate it 90 degrees, the hand isshould still lay 'flat', relative to the ground ( butground; in local coordinate space has, it should moved 90 degrees, to compensate. )
However, I want it to remain attached,attached; so it should continue to follow the other parts, in terms of roll and yaw. IE. ifIf I twisttwist the arm, the hand twists with everything else - it just maintains that 0-degree degree world pitch.
You can find an illustration of Observe the problem here - https://www.youtube.com/watch?v=3tyhJgjfqNsyellow object, in the below example:
In the video, I'm talking about the yellow object.
Does anyone have any suggestions of how IHow can I do this? I would have thought that there was some kind of trick, with matriciesmatrices or quaternions, that could resolve it,it; but I've had no luck, so far. It's hard to figure out what the new 'forward' vector should be.