1 /*************************************************************************** 2 * Copyright (C) 2004-2005 by * 3 * Paolo Sacconier <axa1981@tin.it> * 4 * Francesco Tamagni <minchiahead@hacari.org> * 5 * * 6 * This program is free software; you can redistribute it and/or modify * 7 * it under the terms of the GNU General Public License as published by * 8 * the Free Software Foundation; either version 2 of the License, or * 9 * (at your option) any later version. * 10 * * 11 * This program is distributed in the hope that it will be useful, * 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 * GNU General Public License for more details. * 15 * * 16 * You should have received a copy of the GNU General Public License * 17 * along with this program; if not, write to the * 18 * Free Software Foundation, Inc., * 19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 20 ***************************************************************************/ 21 #ifndef GILLOOMNICAR_H 22 #define GILLOOMNICAR_H 23 24 #include "entity.h" 25 #include "iballpicker.h" 26 #include "simpleball.h" 27 28 namespace gillo { 29 30 /** 31 Omnidirectional car 32 33 @author Paolo Sacconier 34 */ 35 class Omnicar : public Entity, public IBallPicker { 36 37 static const float maxJumpForce = 100; 38 static const float corrIntensity = 100; 39 static sgVec3 dirDim; 40 static sgVec3 carDim; 41 42 static void traslateBody(dBodyID b, dVector3 diff); 43 44 int nWheels; 45 46 SimpleBall& ball; 47 dBodyID dirBid; 48 dGeomID dirGid; 49 // dBodyID rejBid; 50 dBodyID * carBid; 51 dBodyID * wheelBid; 52 // dBodyID borBid[2]; 53 ssgTransform **wheelTrans; 54 ssgTransform **carTrans; 55 // ssgTransform *borTrans[2]; 56 ssgTransform *dirTrans; 57 ssgTransform *rejTrans; 58 // dGeomID pickerGid[4]; 59 dJointID *jam; 60 dJointID diram; 61 dJointGroupID jid; 62 // sgVec3 direction; 63 sgVec3 bodyDir; 64 float speed; 65 float steering; 66 bool backwards; 67 bool jumping; 68 float steerAngle; 69 dJointID ballJoint; 70 float jumpForce; 71 bool fire; 72 float fireTime; 73 float savedCharge; 74 // dJointFeedback jf; 75 76 public: 77 Omnicar(Context &c, SimpleBall& b, float pi = 0, int plid = 0, int nw = 3); 78 79 ~Omnicar(); 80 81 void update(float dt); 82 void move(Entity::Move m); 83 void getPos(sgVec3 out); 84 void setPos(double x, double y, double z); 85 void getMagnetDir(sgVec3 out); 86 void getMagnetPos(sgVec3 out); 87 void addForce(sgVec3 force); 88 bool isPickerGeom(dGeomID o); 89 void releaseBall(); 90 void powerShoot(); 91 }; 92 93 }; 94 95 #endif 96