PJani
17-02-2009 23:47:05
hy i hope someone does know how to solve this, i have frustrations with this for almost 2days and i dont get enywhere.
I created class for creating hinges and holding up data about limits of hinges and motors but i can't figoure out how to get pointer of method for hinge call back here is source code of hinge creator and header
header
I created class for creating hinges and holding up data about limits of hinges and motors but i can't figoure out how to get pointer of method for hinge call back here is source code of hinge creator and header
///////////////////////////
// RE JOINTS
// 170209
///////////////////////////
#include "newton\ReJoints.h"
void ReHingeJoint::joint_callback(OgreNewt::BasicJoints::Hinge* me){
if(enablemotor){
me->setCallbackAccel(me->calculateStopAlpha(Ogre::Radian(ang)));
}
}
ReHingeJoint::ReHingeJoint(OgreNewt::World* world,OgreNewt::Body* child,OgreNewt::Body* parent,Ogre::Vector3 pos, Ogre::Vector3 pin){
jnt = new OgreNewt::BasicJoints::Hinge(world,child,parent ,pos, pin);
OgreNewt::BasicJoints::Hinge::HingeCallback f = ReHingeJoint::joint_callback;
jnt->setCallback(f);
ang = Ogre::Degree(0);
}
void ReHingeJoint::RotateTo(Ogre::Degree deg){
ang = deg;
//angle2 = ang.valueDegrees();
}
void ReHingeJoint::updateHinge(){
//angle2 = ang.valueDegrees();
}
void ReHingeJoint::setMotor(bool motor){
enablemotor = motor;
//enableengine = enablemotor;
}
ReHingeJoint::~ReHingeJoint(){
delete jnt;
}
header
#ifndef REJOINTS_H_INCLUDED
#define REJOINTS_H_INCLUDED
#include <OgreNewt.h>
#include <Ogre.h>
class ReHingeJoint{
public:
ReHingeJoint(OgreNewt::World* world,OgreNewt::Body* child,OgreNewt::Body* parent,Ogre::Vector3 pos, Ogre::Vector3 pin);
void RotateTo(Ogre::Degree deg);
void setMotor(bool motor);
void deltaMove(float delta){ang = Ogre::Degree(ang.valueDegrees() + delta);}
void updateHinge();
OgreNewt::BasicJoints::Hinge* getHinge(){ return jnt; }
~ReHingeJoint();
//void ReHingeJoint::joint_callback(OgreNewt::BasicJoints::Hinge* me);
//void *joint_callback(OgreNewt::BasicJoints::Hinge* me);
private:
void ReHingeJoint::joint_callback(OgreNewt::BasicJoints::Hinge* me);
bool enablemotor;
float acell;
Ogre::Degree ang;
OgreNewt::BasicJoints::Hinge* jnt;
};
#endif // REJOINTS_H_INCLUDED