00001 #include "Joint.h"
00002 #include "opengl.h"
00003
00004 void BallJoint::Update()
00005 {
00006
00007 Vector3 dofs(x.GetVal(),y.GetVal(),z.GetVal());
00008
00009 local.FromEulers(dofs, Matrix34::EULER_XYZ);
00010
00011
00012
00013
00014
00015 if(parent != NULL)
00016 world.Dot(local, (parent->world));
00017 else
00018 world.Dot(local, world);
00019
00020 for(unsigned int i = 0; i < childObjects.size(); i++)
00021 childObjects[i]->Update();
00022 }
00023
00024 void BallJoint::Draw()
00025 {
00026 glPushMatrix();
00027 glMultMatrixf(world);
00028 glutWireCube(0.3);
00029 glPopMatrix();
00030 }
00031 void BallJoint::AttachObject(BallJoint *newObject)
00032 {
00033 childObjects.push_back(newObject);
00034 newObject->parent = this;
00035
00036
00037
00038
00039
00040
00041 }