vrsode/include/vrsode/CarSimple.h

Go to the documentation of this file.
00001 
00002 #ifndef _VRSODE_CAR_SIMPLE_H_
00003 #define _VRSODE_CAR_SIMPLE_H_
00004 
00005 #include "CollisionSpaceSimple.h"
00006 
00007 #include "PhysicsBody.h"
00008 #include "PhysicsJointHinge.h"
00009 #include "PhysicsJointHinge2.h"
00010 #include "PhysicsJointSlider.h"
00011 
00012 #include <vrs/sharedobj.h>
00013 #include <vrs/camera.h>
00014 #include <vrs/sg/scenething.h>
00015 
00016 namespace VRS
00017 {
00018 class Translation;
00019 } // namespace VRS
00020 
00021 
00022 namespace vrsode
00023 {
00024 
00025 class CarSimple : public VRS::SharedObj
00026 {
00027     bool   m_debugNodes;
00028 
00029     double m_springLengthFront;
00030     double m_springLengthRear;
00031     double m_springPowerFront;
00032     double m_springPowerRear;
00033     double m_springSpeedFront;
00034     double m_springSpeedRear;
00035 
00036     double m_wheelSizeFront;
00037     double m_wheelSizeRear;
00038 
00039     double m_wheelMass;
00040     double m_bodyMass;
00041 
00042     double m_wheelMu;
00043     
00044     double m_carMaxSpeed;
00045     double m_carPower;
00046     
00047     VRS::Vector m_wheelOffsetFL;
00048     VRS::Vector m_wheelOffsetFR;
00049     VRS::Vector m_wheelOffsetRL;
00050     VRS::Vector m_wheelOffsetRR;
00051     VRS::Vector m_chassisOffset;
00052     VRS::Vector m_suspensionOffsetFL;
00053     VRS::Vector m_suspensionOffsetFR;
00054     VRS::Vector m_suspensionOffsetRL;
00055     VRS::Vector m_suspensionOffsetRR;
00056     VRS::Vector m_steerOffsetFL;
00057     VRS::Vector m_steerOffsetFR;
00058 
00059     VRS::SO<VRS::SceneThing> m_rootNode;
00060     VRS::SO<CollisionSpace> m_space;
00061     VRS::SO<PhysicsBody> m_chassis;
00062 
00063     VRS::SO<PhysicsBody> m_wheelFL;
00064     VRS::SO<PhysicsBody> m_wheelFR;
00065     VRS::SO<PhysicsBody> m_wheelRL;
00066     VRS::SO<PhysicsBody> m_wheelRR;
00067 
00068     VRS::SO<PhysicsBody> m_suspensionFL;
00069     VRS::SO<PhysicsBody> m_suspensionFR;
00070     VRS::SO<PhysicsBody> m_suspensionRL;
00071     VRS::SO<PhysicsBody> m_suspensionRR;
00072 
00073     VRS::SO<PhysicsBody> m_steerFL;
00074     VRS::SO<PhysicsBody> m_steerFR;
00075 
00076     VRS::SO<PhysicsJointHinge> m_axisFL;
00077     VRS::SO<PhysicsJointHinge> m_axisFR;
00078     VRS::SO<PhysicsJointHinge> m_axisRL;
00079     VRS::SO<PhysicsJointHinge> m_axisRR;
00080 
00081     VRS::SO<PhysicsJointHinge> m_steerControlFL;
00082     VRS::SO<PhysicsJointHinge> m_steerControlFR;
00083 
00084     VRS::SO<PhysicsJointSlider> m_springFL;
00085     VRS::SO<PhysicsJointSlider> m_springFR;
00086     VRS::SO<PhysicsJointSlider> m_springRL;
00087     VRS::SO<PhysicsJointSlider> m_springRR;
00088 
00089     void enableAllBodies();
00090 
00091 public:
00092     CarSimple(VRS::SO<VRS::SceneThing>);
00093     ~CarSimple();
00094 
00099     void accelerate(double);
00100 
00101     void steerLeft(double);
00102     void steerRight(double);
00103 
00104     void handBreak(bool);
00105 
00106     void nos(double);
00107 
00108     VRS::SO<VRS::SceneThing> sceneThing();
00109 
00110     void attachCamera(VRS::SO<VRS::Camera>);
00111 
00116     void setPosition(VRS::Vector);
00117 
00122     void setPosition(double, double, double);
00123 
00127     VRS::Vector position();
00128 
00133     inline VRS::SO<CollisionBody> cameraHook()
00134     {
00135         return m_chassis;
00136     }
00137 };
00138 
00139 }
00140 
00141 #endif

Generated on Fri May 11 21:01:58 2007 for Random Racer by  doxygen 1.5.1