Page 30 of 38

Posted: Tue Feb 08, 2011 12:28 pm
by Sky-Fox
Thank you very much. Problem solved!

I recompile my ODE. (ode_single.dll)

--------------
Cool :D

My Compile version
http://vixen-brush.narod.ru/portfolio/i ... _1/bin.zip

My SRC version
http://vixen-brush.narod.ru/portfolio/i ... _1/src.zip

BSP map
Image
Model
Image

Russian forum
http://www.irrlicht.ru/forum/viewtopic.php?f=1&t=97

Posted: Tue Feb 08, 2011 8:38 pm
by Sky-Fox
How to create a simple scene with the "car".

Posted: Wed Feb 09, 2011 3:38 am
by ulao
Do you have "05-irrOdeCar" ? I know that version in not "simple" but for a full car rig its as simple as it gets.

BrainSaw, Any luck with the " bad arguments in capsule.cpp:51 "error?

Posted: Wed Feb 09, 2011 7:08 am
by Brainsaw
@Sky-Fox: for the car: don't use the "tutorial", I only started it a while ago but didn't finish it. Take a look at the IrrOdeCar demo instead. Making a car is not a big problem once you get to know certain things about the suspension:

- the hinge2 joint features a suspension along the steering axis, so no more things needed there
- I am using a rigid axis for the rear suspension. I do this by using a slide joint that connects the axis to the car body, setting the maximum and minimum position the the same value. Then you need to play around a little with the ERP and CFM parameters of that slider joint so that some actual suspension is there.

The rest is just basic stuff. Add some static nodes, or even some dynamic ones. I really recommend using the IrrEdit plugin for that.

@ulao: sorry, no news there. Maybe I'll find some time to take another look next weekend or so.

Posted: Sat Feb 12, 2011 9:08 am
by Sky-Fox
I can not understand

How to Correctly install and use CIrrOdeMotor
Please tell us how to use motor...
-----------------------------------------------------------------------------------
How to Correctly install and use CIrrOdeJointHinge (SOLVED)
Image
http://robot-alien.com/cesar/ode/

Code: Select all

//JointHinge
//Body1 - Test_OdeBody
//Body2 - Test_OdeBody1
CIrrOdeJointHinge * test_JointHinge=reinterpret_cast<CIrrOdeJointHinge *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_JOINT_HINGE_NAME),Test_OdeBody));
test_JointHinge->setBody2(Test_OdeBody1);
test_JointHinge->setHingeAxis(vector3df(0,1,0));

Posted: Sun Feb 13, 2011 6:16 pm
by Sky-Fox

Posted: Mon Feb 14, 2011 6:52 am
by Brainsaw
I'll take a look at your code when I'm back home (and find some time) ... I shouldn't watch youtube here at work ;)

Posted: Mon Feb 14, 2011 8:19 am
by Sky-Fox

Posted: Mon Feb 14, 2011 12:48 pm
by Sky-Fox
The problem with flying wheels solved

New problem...
Motors are not working...
Parameters of the surface incorrect...

Code: Select all

struct Sky_Car{
vector3df Car_Position;                                         /*Позиция Обьекта в Мире*/
vector3df Car_Rotation;                                         /*Ротация Обьекта в Мире*/
vector3df Car_Scale;                                            /*Размер Обьекта в Мире*/
bool Damage;
//Машинка Целая
CIrrOdeBody *Car_OdeBody;                                       /*Здесь будит храниться Тело(Динамика)*/
IAnimatedMesh *Car_AnimatedMesh;                                /*Здесь будит храниться сама моделька*/
IAnimatedMeshSceneNode *Car_AnimatedMeshSceneNode;              /*Это уже сама Мадельна на Сцене*/
CIrrOdeGeomBox *Car_OdeGeom;                                     /*Здесь будит храниться Геом-Каробка(Динамика)*/
//Машинка Поврежденная
CIrrOdeBody *Car_d_OdeBody;                                     /*Здесь будит храниться Тело(Динамика)*/
IAnimatedMesh *Car_d_AnimatedMesh;                              /*Здесь будит храниться сама моделька*/
IAnimatedMeshSceneNode *Car_d_AnimatedMeshSceneNode;            /*Это уже сама Мадельна на Сцене*/
CIrrOdeGeomBox *Car_d_OdeGeom;                                   /*Здесь будит храниться Геом-Каробка(Динамика)*/
//Калесo 1
CIrrOdeBody *Car_whell_1_OdeBody;                               /*Здесь будит храниться Тело(Динамика)*/
IAnimatedMesh *Car_whell_1_AnimatedMesh;                        /*Здесь будит храниться сама моделька*/
IAnimatedMeshSceneNode *Car_whell_1_AnimatedMeshSceneNode;      /*Это уже сама Мадельна на Сцене*/
CIrrOdeGeomSphere *Car_whell_1_OdeGeom;                          /*Здесь будит храниться Геом-Сфера(Динамика)*/
CIrrOdeJointHinge2 *test_1_JointHinge;
//Калесo 2
CIrrOdeBody *Car_whell_2_OdeBody;                               /*Здесь будит храниться Тело(Динамика)*/
IAnimatedMesh *Car_whell_2_AnimatedMesh;                        /*Здесь будит храниться сама моделька*/
IAnimatedMeshSceneNode *Car_whell_2_AnimatedMeshSceneNode;      /*Это уже сама Мадельна на Сцене*/
CIrrOdeGeomSphere *Car_whell_2_OdeGeom;                          /*Здесь будит храниться Геом-Сфера(Динамика)*/
CIrrOdeJointHinge2 *test_2_JointHinge;
//Калесo 3
CIrrOdeBody *Car_whell_3_OdeBody;                               /*Здесь будит храниться Тело(Динамика)*/
IAnimatedMesh *Car_whell_3_AnimatedMesh;                        /*Здесь будит храниться сама моделька*/
IAnimatedMeshSceneNode *Car_whell_3_AnimatedMeshSceneNode;      /*Это уже сама Мадельна на Сцене*/
CIrrOdeGeomSphere *Car_whell_3_OdeGeom;                          /*Здесь будит храниться Геом-Сфера(Динамика)*/
CIrrOdeJointHinge *test_3_JointHinge;
//Калесo 4
CIrrOdeBody *Car_whell_4_OdeBody;                               /*Здесь будит храниться Тело(Динамика)*/
IAnimatedMesh *Car_whell_4_AnimatedMesh;                        /*Здесь будит храниться сама моделька*/
IAnimatedMeshSceneNode *Car_whell_4_AnimatedMeshSceneNode;      /*Это уже сама Мадельна на Сцене*/
CIrrOdeGeomSphere *Car_whell_4_OdeGeom;                          /*Здесь будит храниться Геом-Сфера(Динамика)*/
CIrrOdeJointHinge *test_4_JointHinge;
};

Code: Select all

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Sky_Car MyCar;
    MyCar.Car_Position=vector3df(0.0f,-100.0f,0.0f);
    MyCar.Car_Scale=vector3df(30.0f,30.0f,30.0f);
    MyCar.Damage=0;

MyCar.Car_OdeBody=reinterpret_cast<CIrrOdeBody *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_BODY_NAME),worldNode));
//MyCar.Car_OdeBody->setPosition(MyCar.Car_Position);

MyCar.Car_AnimatedMesh=smgr->getMesh("data/car_c.x");

MyCar.Car_AnimatedMeshSceneNode=smgr->addAnimatedMeshSceneNode(MyCar.Car_AnimatedMesh,MyCar.Car_OdeBody);

    MyCar.Car_AnimatedMeshSceneNode->setMaterialTexture(0,driver->getTexture("data/car_c_c1.tga"));
    MyCar.Car_AnimatedMeshSceneNode->setMaterialFlag(EMF_LIGHTING,false);
    MyCar.Car_AnimatedMeshSceneNode->setScale(MyCar.Car_Scale);
    MyCar.Car_AnimatedMeshSceneNode->setVisible(!MyCar.Damage);
    MyCar.Car_AnimatedMeshSceneNode->setPosition(MyCar.Car_Position);

MyCar.Car_OdeGeom=reinterpret_cast<CIrrOdeGeomBox *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_GEOM_BOX_NAME),MyCar.Car_AnimatedMeshSceneNode));
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setUseDefined(false);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setModeMu2(false);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setModeFDir1(false);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setModeBounce(true);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setModeSoftERP(false);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setModeSoftCFM(false);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setModeMotion1(false);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setModeMotion2(false);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setModeMotionN(false);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setModeSlip1(false);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setModeSlip2(false);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setModeApprox1_1(false);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setModeApprox1_2(false);

    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setMu(300.000000);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setMu2(200.000000);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setBounce(0.200000);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setBounceVel(0.000000);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setSoftErp(0.000000);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setSoftCfm(0.000000);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setMotion1(0.000000);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setMotion2(0.000000);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setMotionN(0.000000);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setSlip1(0.000000);
    MyCar.Car_OdeGeom->getSurfaceParameters(0)->setSlip2(0.000000);
    MyCar.Car_OdeGeom->setMassTotal(1.000000);

    MyCar.Car_OdeGeom->drop();

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

MyCar.Car_d_AnimatedMesh=smgr->getMesh("data/car_d.x");

MyCar.Car_d_AnimatedMeshSceneNode=smgr->addAnimatedMeshSceneNode(MyCar.Car_d_AnimatedMesh,MyCar.Car_OdeBody);
    MyCar.Car_d_AnimatedMeshSceneNode->setMaterialTexture(0,driver->getTexture("data/car_d_c1.tga"));
    MyCar.Car_d_AnimatedMeshSceneNode->setMaterialFlag(EMF_LIGHTING,false);
    MyCar.Car_d_AnimatedMeshSceneNode->setScale(MyCar.Car_Scale);
    MyCar.Car_d_AnimatedMeshSceneNode->setVisible(MyCar.Damage);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MyCar.test_1_JointHinge=reinterpret_cast<CIrrOdeJointHinge2 *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_JOINT_HINGE2_NAME),MyCar.Car_OdeBody));

MyCar.Car_whell_1_OdeBody=reinterpret_cast<CIrrOdeBody *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_BODY_NAME),MyCar.test_1_JointHinge));
MyCar.Car_whell_1_AnimatedMesh=smgr->getMesh("data/whell.x");

MyCar.Car_whell_1_AnimatedMeshSceneNode=smgr->addAnimatedMeshSceneNode(MyCar.Car_whell_1_AnimatedMesh,MyCar.Car_whell_1_OdeBody);
    MyCar.Car_whell_1_AnimatedMeshSceneNode->setMaterialTexture(0,driver->getTexture("data/whell.tga"));
    MyCar.Car_whell_1_AnimatedMeshSceneNode->setMaterialFlag(EMF_LIGHTING,false);
    MyCar.Car_whell_1_AnimatedMeshSceneNode->setScale(MyCar.Car_Scale);
    MyCar.Car_whell_1_AnimatedMeshSceneNode->setPosition((MyCar.Car_AnimatedMeshSceneNode->getPosition())+(MyCar.Car_Scale * (MyCar.Car_AnimatedMeshSceneNode->getJointNode("b_whee1")->getPosition())));

MyCar.Car_whell_1_OdeGeom=reinterpret_cast<CIrrOdeGeomSphere *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_GEOM_SPHERE_NAME),MyCar.Car_whell_1_AnimatedMeshSceneNode));
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setUseDefined(false);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setModeMu2(false);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setModeFDir1(false);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setModeBounce(true);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setModeSoftERP(false);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setModeSoftCFM(false);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setModeMotion1(false);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setModeMotion2(false);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setModeMotionN(false);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setModeSlip1(false);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setModeSlip2(false);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setModeApprox1_1(false);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setModeApprox1_2(false);

    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setMu(200.000000);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setMu2(125.000000);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setBounce(0.250000);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setBounceVel(0.000000);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setSoftErp(0.000000);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setSoftCfm(0.000000);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setMotion1(0.000000);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setMotion2(0.000000);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setMotionN(0.000000);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setSlip1(0.250000);
    MyCar.Car_whell_1_OdeGeom->getSurfaceParameters(0)->setSlip2(0.250000);
    MyCar.Car_whell_1_OdeGeom->setMassTotal(0.010000);

    MyCar.Car_whell_1_OdeGeom->drop();


MyCar.test_1_JointHinge->setBody2(MyCar.Car_whell_1_OdeBody);
MyCar.test_1_JointHinge->setHingeAxis1(vector3df(0,1,0));
MyCar.test_1_JointHinge->setHingeAxis2(vector3df(1,0,0));
MyCar.test_1_JointHinge->setPosition((MyCar.Car_AnimatedMeshSceneNode->getPosition())+(MyCar.Car_Scale * (MyCar.Car_AnimatedMeshSceneNode->getJointNode("b_whee1")->getPosition())));
MyCar.test_1_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eHiStop, false);
MyCar.test_1_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eLoStop, false);
MyCar.test_1_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eVel, false);
MyCar.test_1_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eMaxForce, false);
MyCar.test_1_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eFudge, false);
MyCar.test_1_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eBounce, false);
MyCar.test_1_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eCFM, false);
MyCar.test_1_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eStopERP, false);
MyCar.test_1_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eStopCFM, false);
MyCar.test_1_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eSuspensionERP, false);
MyCar.test_1_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eSuspensionCFM, false);
//MyCar.test_1_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eParamEnd, false);



CIrrOdeMotor * test_1_OdeMotor=reinterpret_cast<CIrrOdeMotor *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_MOTOR_NAME),MyCar.Car_whell_1_OdeBody));
test_1_OdeMotor->setJoint(MyCar.test_1_JointHinge);
test_1_OdeMotor->setAutomaticCulling(EAC_BOX);
test_1_OdeMotor->setAxis(0);
test_1_OdeMotor->setForce(500.000000);
test_1_OdeMotor->setVelocity(1.000000);
test_1_OdeMotor->setEnabled(true);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MyCar.test_2_JointHinge=reinterpret_cast<CIrrOdeJointHinge2 *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_JOINT_HINGE2_NAME),MyCar.Car_OdeBody));

MyCar.Car_whell_2_OdeBody=reinterpret_cast<CIrrOdeBody *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_BODY_NAME),MyCar.test_2_JointHinge));
MyCar.Car_whell_2_AnimatedMesh=smgr->getMesh("data/whell.x");

MyCar.Car_whell_2_AnimatedMeshSceneNode=smgr->addAnimatedMeshSceneNode(MyCar.Car_whell_1_AnimatedMesh,MyCar.Car_whell_2_OdeBody);
    MyCar.Car_whell_2_AnimatedMeshSceneNode->setMaterialTexture(0,driver->getTexture("data/whell.tga"));
    MyCar.Car_whell_2_AnimatedMeshSceneNode->setMaterialFlag(EMF_LIGHTING,false);
    MyCar.Car_whell_2_AnimatedMeshSceneNode->setScale(MyCar.Car_Scale);
    MyCar.Car_whell_2_AnimatedMeshSceneNode->setPosition((MyCar.Car_AnimatedMeshSceneNode->getPosition())+((MyCar.Car_AnimatedMeshSceneNode->getJointNode("b_whee2")->getPosition())*MyCar.Car_Scale));

MyCar.Car_whell_2_OdeGeom=reinterpret_cast<CIrrOdeGeomSphere *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_GEOM_SPHERE_NAME),MyCar.Car_whell_2_AnimatedMeshSceneNode));
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setUseDefined(false);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setModeMu2(false);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setModeFDir1(false);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setModeBounce(true);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setModeSoftERP(false);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setModeSoftCFM(false);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setModeMotion1(false);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setModeMotion2(false);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setModeMotionN(false);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setModeSlip1(false);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setModeSlip2(false);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setModeApprox1_1(false);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setModeApprox1_2(false);

    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setMu(200.000000);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setMu2(125.000000);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setBounce(0.250000);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setBounceVel(0.000000);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setSoftErp(0.000000);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setSoftCfm(0.000000);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setMotion1(0.000000);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setMotion2(0.000000);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setMotionN(0.000000);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setSlip1(0.250000);
    MyCar.Car_whell_2_OdeGeom->getSurfaceParameters(0)->setSlip2(0.250000);
    MyCar.Car_whell_2_OdeGeom->setMassTotal(0.010000);

    MyCar.Car_whell_2_OdeGeom->drop();


MyCar.test_2_JointHinge->setBody2(MyCar.Car_whell_2_OdeBody);
MyCar.test_2_JointHinge->setHingeAxis1(vector3df(0,1,0));
MyCar.test_2_JointHinge->setHingeAxis2(vector3df(1,0,0));
MyCar.test_2_JointHinge->setPosition((MyCar.Car_AnimatedMeshSceneNode->getPosition())+((MyCar.Car_AnimatedMeshSceneNode->getJointNode("b_whee2")->getPosition())*MyCar.Car_Scale));
MyCar.test_2_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eHiStop, false);
MyCar.test_2_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eLoStop, false);
MyCar.test_2_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eVel, false);
MyCar.test_2_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eMaxForce, false);
MyCar.test_2_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eFudge, false);
MyCar.test_2_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eBounce, false);
MyCar.test_2_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eCFM, false);
MyCar.test_2_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eStopERP, false);
MyCar.test_2_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eStopCFM, false);
MyCar.test_2_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eSuspensionERP, false);
MyCar.test_2_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eSuspensionCFM, false);
//MyCar.test_2_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eParamEnd, false);


CIrrOdeMotor * test_2_OdeMotor=reinterpret_cast<CIrrOdeMotor *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_MOTOR_NAME),MyCar.Car_whell_2_OdeBody));
test_2_OdeMotor->setJoint(MyCar.test_2_JointHinge);
test_2_OdeMotor->setAutomaticCulling(EAC_BOX);
test_2_OdeMotor->setAxis(0);
test_2_OdeMotor->setForce(500.000000);
test_2_OdeMotor->setVelocity(1.000000);
test_2_OdeMotor->setEnabled(true);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MyCar.test_3_JointHinge=reinterpret_cast<CIrrOdeJointHinge *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_JOINT_HINGE_NAME),MyCar.Car_OdeBody));

MyCar.Car_whell_3_OdeBody=reinterpret_cast<CIrrOdeBody *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_BODY_NAME),MyCar.test_3_JointHinge));
MyCar.Car_whell_3_AnimatedMesh=smgr->getMesh("data/whell.x");

MyCar.Car_whell_3_AnimatedMeshSceneNode=smgr->addAnimatedMeshSceneNode(MyCar.Car_whell_1_AnimatedMesh,MyCar.Car_whell_3_OdeBody);
    MyCar.Car_whell_3_AnimatedMeshSceneNode->setMaterialTexture(0,driver->getTexture("data/whell.tga"));
    MyCar.Car_whell_3_AnimatedMeshSceneNode->setMaterialFlag(EMF_LIGHTING,false);
    MyCar.Car_whell_3_AnimatedMeshSceneNode->setScale(MyCar.Car_Scale);
    MyCar.Car_whell_3_AnimatedMeshSceneNode->setPosition((MyCar.Car_AnimatedMeshSceneNode->getPosition())+((MyCar.Car_AnimatedMeshSceneNode->getJointNode("b_whee3")->getPosition())*MyCar.Car_Scale));

MyCar.Car_whell_3_OdeGeom=reinterpret_cast<CIrrOdeGeomSphere *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_GEOM_SPHERE_NAME),MyCar.Car_whell_3_AnimatedMeshSceneNode));
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setUseDefined(false);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setModeMu2(false);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setModeFDir1(false);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setModeBounce(true);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setModeSoftERP(false);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setModeSoftCFM(false);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setModeMotion1(false);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setModeMotion2(false);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setModeMotionN(false);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setModeSlip1(false);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setModeSlip2(false);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setModeApprox1_1(false);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setModeApprox1_2(false);

    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setMu(200.000000);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setMu2(125.000000);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setBounce(0.250000);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setBounceVel(0.000000);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setSoftErp(0.000000);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setSoftCfm(0.000000);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setMotion1(0.000000);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setMotion2(0.000000);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setMotionN(0.000000);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setSlip1(0.250000);
    MyCar.Car_whell_3_OdeGeom->getSurfaceParameters(0)->setSlip2(0.250000);
    MyCar.Car_whell_3_OdeGeom->setMassTotal(0.010000);

    MyCar.Car_whell_3_OdeGeom->drop();


MyCar.test_3_JointHinge->setBody2(MyCar.Car_whell_3_OdeBody);
MyCar.test_3_JointHinge->setHingeAxis(vector3df(1,0,0));
MyCar.test_3_JointHinge->setPosition((MyCar.Car_AnimatedMeshSceneNode->getPosition())+((MyCar.Car_AnimatedMeshSceneNode->getJointNode("b_whee3")->getPosition())*MyCar.Car_Scale));
MyCar.test_3_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eHiStop, false);
MyCar.test_3_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eLoStop, false);
MyCar.test_3_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eVel, false);
MyCar.test_3_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eMaxForce, false);
MyCar.test_3_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eFudge, false);
MyCar.test_3_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eBounce, false);
MyCar.test_3_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eCFM, false);
MyCar.test_3_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eStopERP, false);
MyCar.test_3_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eStopCFM, false);
MyCar.test_3_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eSuspensionERP, false);
MyCar.test_3_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eSuspensionCFM, false);
//MyCar.test_3_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eParamEnd, false);


CIrrOdeMotor * test_3_OdeMotor=reinterpret_cast<CIrrOdeMotor *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_MOTOR_NAME),MyCar.Car_whell_3_OdeBody));
test_3_OdeMotor->setJoint(MyCar.test_3_JointHinge);
test_3_OdeMotor->setAutomaticCulling(EAC_BOX);
test_3_OdeMotor->setAxis(0);
test_3_OdeMotor->setForce(500.000000);
test_3_OdeMotor->setVelocity(1.000000);
test_3_OdeMotor->setEnabled(true);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
MyCar.test_4_JointHinge=reinterpret_cast<CIrrOdeJointHinge *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_JOINT_HINGE_NAME),MyCar.Car_OdeBody));

MyCar.Car_whell_4_OdeBody=reinterpret_cast<CIrrOdeBody *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_BODY_NAME),MyCar.test_4_JointHinge));
MyCar.Car_whell_4_AnimatedMesh=smgr->getMesh("data/whell.x");

MyCar.Car_whell_4_AnimatedMeshSceneNode=smgr->addAnimatedMeshSceneNode(MyCar.Car_whell_1_AnimatedMesh,MyCar.Car_whell_4_OdeBody);
    MyCar.Car_whell_4_AnimatedMeshSceneNode->setMaterialTexture(0,driver->getTexture("data/whell.tga"));
    MyCar.Car_whell_4_AnimatedMeshSceneNode->setMaterialFlag(EMF_LIGHTING,false);
    MyCar.Car_whell_4_AnimatedMeshSceneNode->setScale(MyCar.Car_Scale);
    MyCar.Car_whell_4_AnimatedMeshSceneNode->setPosition((MyCar.Car_AnimatedMeshSceneNode->getPosition())+((MyCar.Car_AnimatedMeshSceneNode->getJointNode("b_whee4")->getPosition())*MyCar.Car_Scale));

MyCar.Car_whell_4_OdeGeom=reinterpret_cast<CIrrOdeGeomSphere *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_GEOM_SPHERE_NAME),MyCar.Car_whell_4_AnimatedMeshSceneNode));
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setUseDefined(false);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setModeMu2(false);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setModeFDir1(false);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setModeBounce(true);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setModeSoftERP(false);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setModeSoftCFM(false);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setModeMotion1(false);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setModeMotion2(false);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setModeMotionN(false);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setModeSlip1(false);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setModeSlip2(false);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setModeApprox1_1(false);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setModeApprox1_2(false);

    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setMu(200.000000);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setMu2(125.000000);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setBounce(0.250000);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setBounceVel(0.000000);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setSoftErp(0.000000);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setSoftCfm(0.000000);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setMotion1(0.000000);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setMotion2(0.000000);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setMotionN(0.000000);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setSlip1(0.250000);
    MyCar.Car_whell_4_OdeGeom->getSurfaceParameters(0)->setSlip2(0.250000);
    MyCar.Car_whell_4_OdeGeom->setMassTotal(0.010000);

    MyCar.Car_whell_4_OdeGeom->drop();

MyCar.test_4_JointHinge->setBody2(MyCar.Car_whell_4_OdeBody);
MyCar.test_4_JointHinge->setHingeAxis(vector3df(1,0,0));
MyCar.test_4_JointHinge->setPosition((MyCar.Car_AnimatedMeshSceneNode->getPosition())+((MyCar.Car_AnimatedMeshSceneNode->getJointNode("b_whee4")->getPosition())*MyCar.Car_Scale));
MyCar.test_4_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eHiStop, false);
MyCar.test_4_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eLoStop, false);
MyCar.test_4_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eVel, false);
MyCar.test_4_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eMaxForce, false);
MyCar.test_4_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eFudge, false);
MyCar.test_4_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eBounce, false);
MyCar.test_4_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eCFM, false);
MyCar.test_4_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eStopERP, false);
MyCar.test_4_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eStopCFM, false);
MyCar.test_4_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eSuspensionERP, false);
MyCar.test_4_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eSuspensionCFM, false);
//MyCar.test_4_JointHinge->setParameter(0, irr::ode::CIrrOdeJoint::eParamEnd, false);


CIrrOdeMotor * test_4_OdeMotor=reinterpret_cast<CIrrOdeMotor *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_MOTOR_NAME),MyCar.Car_whell_4_OdeBody));
test_4_OdeMotor->setJoint(MyCar.test_4_JointHinge);
test_4_OdeMotor->setAutomaticCulling(EAC_BOX);
test_4_OdeMotor->setAxis(0);
test_4_OdeMotor->setForce(500.000000);
test_4_OdeMotor->setVelocity(10.000000);
test_4_OdeMotor->setEnabled(true);



Posted: Mon Feb 14, 2011 3:35 pm
by Sky-Fox
Please tell us how to set "Anchor1" and "Anchor2" for Joint Hinge2
Image

Code: Select all

MyCar.test_1_JointHinge=reinterpret_cast<CIrrOdeJointHinge2 *>(smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_JOINT_HINGE2_NAME),MyCar.Car_OdeBody));
MyCar.test_1_JointHinge->setBody2(MyCar.Car_whell_1_OdeBody);
MyCar.test_1_JointHinge->setHingeAxis1(vector3df(0,1,0));
MyCar.test_1_JointHinge->setHingeAxis2(vector3df(1,0,0));

Posted: Mon Feb 14, 2011 3:48 pm
by ulao
Sky-Fox, Brainsaw is a good guy and does this as a hobby. He knows his stuff and can/will help you in time. Its sort of difficult to do so with so many posts.

Few suggestions.

1) Try to edit posts and just add to them rather then make more.
2) Code examples are helpful but code pages?
3) Remember he created the wrapper not the engine. However I will admit he is the best resource for ODE info on the net.

Posted: Mon Feb 14, 2011 4:13 pm
by Sky-Fox
The wrapper very cool!

Posted: Tue Feb 15, 2011 7:02 am
by Brainsaw
@ulao: thanks for the compliment, I guess I'm currently turning red (lucky me noone's around right now ;) ).

@sky-fox: I have tried to get it working yesterday, and I partly succeeded. The car is working, but it still sinks into the ground a bit (maybe try to modify the size of the spheres you use for the wheels). You can download a modified version at http://bulletbyte.de/download/SkyFox_game.zip (I'll leave it there for a week or so). Here are some issues I stumbled upon:

- you don't need to set every parameter of the surfaces manually, by default the flags are disabled
- initialize the attributes in order. Add a hinge to the car and set it's position and the other stuff, and then add the wheel, not vice versa. If you don't do this in order it seems to confuse the wrapper quite a bit
- you shouldn't set the positions of the child nodes. If you attach a node to another (e.g. the hinges to the body) you set the position of the hinge to the right position and attach the wheels at (0,0,0)
- set the hi and lo stop of the steering axes of the hinge two joint, this way it stays in this position (or attach a CIrrOdeServo to those joints).

If you really want to hard-code the levels I have a tip: install IrrEdit and the IrrOdEdit plugin and save the scene before initializing physics (which breaks the scene graph tree), this way you can see where all the nodes are and might be able to figure out what's wrong. It also helps to give a unique name to every node.

Posted: Tue Feb 15, 2011 8:36 pm
by Sky-Fox

Posted: Sat Feb 19, 2011 1:19 pm
by Brainsaw
I have uploaded a new version. The only change is that there are now two forests (created with my "Random Forest Plugin" for IrrEdit - http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=43067) in the IrrOdeCar demo. This also shows a nice feature of that new plugin: I have added IrrOde geoms as children of the tree templates, and these are also copied so that you can collide with the trees generated by the plugin.