Using bone.lookat for bones other than head
Hi!
Is it possible to use bone.lookat for bones other than the head? I use the following code to always point the hand towards an object but it stays perpendicular! Code:
def lookAtBall(): Best, Omid |
Here is the forearm added to an example that Farshizzo recently posted for using lookat. It works for other bones, I just had to subtract 90 degrees from the yaw value to make it look right.
Code:
import viz |
Hi,
Thanks for the example code. I added 60 degrees to the roll and now it looks better. I did the same experiment with left upper arm, and I had to make a different correction to make it right. My impression is that the lookat function makes the joint to look at a certain direction and the bone connected to the joint is not in 0 degrees relative to the joint. Am I right? Is it a way to find the exact corrections for each bone? The code below is the modified code: Code:
import viz |
It seems like the lookAt method takes the origin of the bone and has that look at the position you pass to it . If you want the end of the bone to look at something you may have to add some rotation to make it look right. Farshizzo, please correct me if I'm wrong about this.
|
That's right, but since I need to control the bones precisely, I want to have the precise rotations that make the end of the bone point at a certain direction. Do you think it's possible?
|
I not quite sure how to calculate the exact offsets for all the angles. Farshizzo's on vacation for a little while but I'm sure he'll have some idea when he gets back. Do you only need to do this for the arm bones?
|
Interesting... What will you do with this, omidbrb?
Seems you could get the local bounding box of a bone, find the box face center point that is furthest from the bone origin, compute the angle between the bone's x-axis and the center point of the furthest box face, and rotate that angle difference after the lookat command. |
Quote:
|
All times are GMT -7. The time now is 09:20 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC