random_racer/src/BuggyFunCar.h

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

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