no way with 1.53
1.53 does no exist anymore.
Moderators: Sascha Willems, walaber
NewtonMaterialSetCollisionCallback (p_world, idMat1, idMat2, NULL, beginDefaultContactCallback, processDefaultContactCallback);
int vehi_hdRepresentation::beginDefaultContactCallback(const NewtonMaterial* material, const NewtonBody* body0, const NewtonBody* body1)
{
contactHD = 0;
contactProcessed = false;
int id0 = NewtonBodyGetMaterialGroupID(body0);
int id1 = NewtonBodyGetMaterialGroupID(body1);
vehi_physics* physics = vehi_register::AppManager->getPhysics();
vehi_materialData* matData= physics->getMaterialData();
stringc matName = "";
matName = matData->getName(id0);
if (strcmp(matName.c_str(), "haptic")==0)
contactHD = ((vehi_hdRepresentation*) NewtonBodyGetUserData(body0));
else
{
matName = matData->getName(id1);
if (strcmp(matName.c_str(), "haptic")==0)
contactHD = ((vehi_hdRepresentation*) NewtonBodyGetUserData(body1));
}
return 1;
}
int vehi_hdRepresentation::processDefaultContactCallback(const NewtonMaterial* material, const NewtonContact* contact)
{
contactProcessed = true;
render();
contactHD = 0;
contactProcessed = false;
return 1;
}
telmopereira wrote:Hi,
I saw that pages yesterday. One of my doubts is about OnAABBOverlap. In this page, http://newtondynamics.com/wiki/index.php5?title=NewtonContactBegin , its explain how works NewtonContactBegin for Newton 1.53 and i can't find something similar about OnAABBOverlap. Can you please show me one code example like i present before, but now using OnAABBOverlap instead of BeginContact ?
Thanks,
Telmo
class CustomKinematicController: public NewtonCustomJoint
{
public:
CustomKinematicController (const NewtonBody* body, const dVector& attachmentPointInGlobalSpace);
virtual ~CustomKinematicController();
void SetPickMode (int mode);
void SetMaxLinearFriction(dFloat accel);
void SetMaxAngularFriction(dFloat alpha);
void SetTargetRotation (const dQuaternion& rotation);
void SetTargetPosit (const dVector& posit);
void SetTargetMatrix (const dMatrix& matrix);
dMatrix GetTargetMatrix () const;
protected:
virtual void SubmitConstraints (dFloat timestep, int threadIndex);
virtual void GetInfo (NewtonJointRecord* info) const;
int m_pickMode;
int m_autoSlepState;
dFloat m_maxLinearFriction;
dFloat m_maxAngularFriction;
dVector m_localHandle;
dVector m_targetPosit;
dQuaternion m_targetRot;
};
NewtonBodyGetMatrix(body, &p_matrix[0][0]);
kinematic = new CustomKinematicController (body, &p_matrix.m_posit[0]);
kinematic->SetPickMode(1);
kinematic->SetMaxAngularFriction(2.0f);
kinematic->SetMaxLinearFriction(2.0f);
kinematic->SetTargetMatrix(p_matrix);
vector3df actualPos = vector3df(p_pos.X/2,p_pos.Y/2,-p_pos.Z/2);
p_irrSceneNode->setPosition(actualPos);
matrix4 mat;
mat.setTranslation( getPosition() );
//NewtonBodySetMatrix(p_body, mat.pointer());
p_matrix.m_posit.m_x = mat[12];
p_matrix.m_posit.m_y = mat[13];
p_matrix.m_posit.m_z = mat[14];
kinematic->SetTargetMatrix(p_matrix);
vector3df actualPos = vector3df(p_pos.X/2,p_pos.Y/2,-p_pos.Z/2);
p_irrSceneNode->setPosition(actualPos);
matrix4 mat;
mat.setTranslation( getPosition() );
p_matrix.m_posit.m_x = mat[12];
p_matrix.m_posit.m_y = mat[13];
p_matrix.m_posit.m_z = mat[14];
kinematic->SetTargetMatrix(p_matrix);
Users browsing this forum: No registered users and 2 guests