matching object rotation and position
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2004 at 00:43, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.200
Platform: Windows ;
Language(s) : C.O.F.F.E.E ; XPRESSO ;---------
I´m trying to match the rotation and postion of a bone. Everything works fine as long as I dont rotate the bone; my snippet://I have created the cube object beforehand as an example var bonePos = stepObject->GetPosition(); var boneScale = stepObject->GetScale(); var boneRot = stepObject->GetRotation(); var cnt_cube->SetData(PRIM_CUBE_LEN, vector(100,100,200)); cube->SetContainer(cnt_cube); cube->SetRotation(boneRot); cube->SetPosition(bonePos);
The rotation is almost matched, but there is an off off the position. I have searched the forum, but only came up with a thread of someone with the same problem, like wise him, I have also tried using the Global coodinates of both objects to no avail. I have also tried changing the order of the commands rotating first then positioning
Thanks for any help or tips in advance
(sorry for the the bad code formatting, I couldnt get it right in the provided textfield)nhytro
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2004 at 02:17, xxxxxxxx wrote:
Have you made sure that the cube's axis is at one of the ends? (That's where the bone's axis is.) If it's a parametric cube you cannot move its axis. The easiest way would probably be to just place the cube in an empty object. Otherwise you'll have to work out some (easy) 3D math to add an offset.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/03/2004 at 07:31, xxxxxxxx wrote:
Actually I wanted the axis of both objects to match the axis of the bone(root of the bone in the case) This works when the bone is not rotated. Do u have a small example of the easy 3d math you are talking about?
Thanks in advance Mikael
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/03/2004 at 15:32, xxxxxxxx wrote:
To only align the axes, the following code will always work:
cube->SetMg(bone->GetMg());
To add an offset to this, to account for the centered axis of the cube, you would have to do:
var bmg = bone->GetMg(); bmg->SetV0(bmg->GetV0() + bmg->GetV3() * 100); cube->SetMg(bmg);
100 is half the cube's Z length. We're positioning the cube 100 units off the bone's axis along the bone's Z axis.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/03/2004 at 00:22, xxxxxxxx wrote:
Great thanks Mikael