suryaatvellore
20-06-2012 10:48:23
In the GranTurismo demo the car seems to quite unstable..while turning it tumbles to the turning side..So is there any function in OgreODE by which i can set the COM of the car??
suryaatvellore
20-06-2012 10:48:23
dermont
20-06-2012 14:52:30
In the GranTurismo demo the car seems to quite unstable..while turning it tumbles to the turning side..So is there any function in OgreODE by which i can set the COM of the car??
suryaatvellore
22-06-2012 08:32:42
dermont
22-06-2012 09:06:00
whre are the keypresses for forward mvmnt and turning handled?I have also gone through the granturism.cpp file but couldnt find the code for the movement and turning..the only code is find is
_vehicle->setInputs(mKeyboard->isKeyDown(OIS::KC_J),
mKeyboard->isKeyDown(OIS::KC_L),
mKeyboard->isKeyDown(OIS::KC_I),
mKeyboard->isKeyDown(OIS::KC_K));
_vehicle->update(time);
where is the update function?
@dermont I looked at the damping and the friction variables for all the wheels but doesnt seem to be working.Does the solution have anything to do with the turn angle of the car as in a normal car?
suryaatvellore
22-06-2012 10:19:13
dermont
22-06-2012 11:13:08
could you also tell me if the world in the GranTurism demo has been loaded via a mesh file or has it been created implicitly in the source code?
SceneNode *track_node = mSceneMgr->getRootSceneNode()->createChildSceneNode("track");
Entity *track_mesh = mSceneMgr->createEntity("track","racingcircuit.mesh");
track_node->attachObject(track_mesh);
OgreOde::EntityInformer ei(track_mesh);
_track = ei.createStaticTriangleMesh(_world, _world->getDefaultSpace());
track_mesh->setUserAny(Ogre::Any(_track));
and where can i find the PowerAtRPM,getDesiredRPM functions?
Real Vehicle::Engine::getDesiredRPM()
Real Vehicle::Engine::getPowerAtRPM(Real rpm)
if the latter then how have the textures been applied?
>>OgreXMLConverter scooby_body.mesh (creates scooby_body.xml)
suryaatvellore
22-06-2012 12:21:43
dermont
22-06-2012 17:42:20
mCamera->setPosition(Vector3(125,-14,8));
this line is responsible for changing how we look at the car.but this position is set with respect to some point.and if i want to create two cameras where do i mention the presence of two scene managers.
suryaatvellore
23-06-2012 06:15:34
suryaatvellore
23-06-2012 09:52:41
dermont
23-06-2012 10:07:45
I tried creating a new camera by this code
void Vehicle::changeCamera()
{
mCamera = mSceneMgr->createCamera("PlayerCam1");
mCamera->setPosition(Vector3(125,-14,8));
mCamera->lookAt(mCamera->getPosition() + Ogre::Vector3(0,0,1));
mCamera->setNearClipDistance( 1 );
mCamera->setFarClipDistance( 1000 );
}
if(mKeyBoard->isKeyDown(OIS::KC_Z))
{
changeCamera();
}
first of all it says not declared in the scope error and i have included the prototype in the .h file of GT.second even if it works wouldnt th enew camera mask the older one.I want different viewports.
// Thanks to Ahmed!
static Ogre::Real followFactor = 0.2;
static Ogre::Real camHeight = 2.0;
static Ogre::Real camDistance = 7.0;
static Ogre::Real camLookAhead = 8.0;
....
if ((mKeyboard->isKeyDown(OIS::KC_2))) {
if (mTimeUntilNextToggle <= 0) {
camDistance = 7.0;
mTimeUntilNextToggle = 0.5;
} }
if ((mKeyboard->isKeyDown(OIS::KC_1))) {
if (mTimeUntilNextToggle <= 0) {
camDistance = 0.0;
mTimeUntilNextToggle = 0.5;
}}
GranTurismOgreFrameListener::changeCamera()
suryaatvellore
25-06-2012 12:31:21
dermont
26-06-2012 11:26:08
if(mKeyboard->isKeyDown(OIS::KC_3))
{
mCamera->setPosition(90,30,90);
}
if(mKeyboard->isKeyDown(OIS::KC_4))
{
mCamera->setPosition(80,-10,60);
}
this coding toggles the camera but if i want to make the cameras stay at a particular position then do i need to define seperate cameras?and using similar coding can u still provide me the coding for a driver view..i have tried and although i get the view..the car rushes forward and the view is disturbed(we r back to back view)..could you provide the solution for this?
Quaternion q = _vehicle->getSceneNode()->getOrientation();
Vector3 toCam = _vehicle->getSceneNode()->getPosition();
toCam.y += camHeight;
toCam.z -= camDistance * q.zAxis().z;
toCam.x -= camDistance * q.zAxis().x;
->-> mCamera->move( (toCam - mCamera->getPosition()) * followFactor );
mCamera->lookAt(_vehicle->getSceneNode()->getPosition() + ((_vehicle->getSceneNode()->getOrientation() * Ogre::Vector3::UNIT_Z) * camLookAhead));
if(mKeyboard->isKeyDown(OIS::KC_4))
{
mCamera->setPosition(80,-10,60);
followFactor=0.0f;
}
suryaatvellore
26-06-2012 11:31:05
dermont
27-06-2012 17:26:53
< void Vehicle::Wheel::update(Real power_force,Real desired_rpm,Real brake_force,bool reverse)
---
> void Vehicle::Wheel::update(Real power_force,Real desired_rpm,Real brake_force)
173,177c173
< if (reverse)
< _joint->setParameter(Joint::Parameter_MotorVelocity,-desired_rpm,2);
< else
< _joint->setParameter(Joint::Parameter_MotorVelocity,desired_rpm,2);
<
---
> _joint->setParameter(Joint::Parameter_MotorVelocity,desired_rpm,2);
230,231c226
< _swayForceLimit (0),
< _reverse(false)
---
> _swayForceLimit (0)
352c347
< void Vehicle::setInputs(bool left,bool right,bool throttle,bool brake, bool reverse)
---
> void Vehicle::setInputs(bool left,bool right,bool throttle,bool brake)
354c349
< if (left || right || throttle || reverse)
---
> if (left || right || throttle)
362,364d356
< _reverse = reverse;
< if (_reverse)
< throttle = true;
412d403
<
443c434
< (*i)->update(power, desired_rpm, brake, _reverse);
---
> (*i)->update(power, desired_rpm, brake);
109c109
< void update(Ogre::Real power_force, Ogre::Real desired_rpm, Ogre::Real brake_force,bool reverse=false);
---
> void update(Ogre::Real power_force, Ogre::Real desired_rpm, Ogre::Real brake_force);
161c161
<
---
>
164c164
< void setInputs(bool left, bool right, bool throttle, bool brake, bool reverse);
---
> void setInputs(bool left, bool right, bool throttle, bool brake);
243d242
< bool _reverse;
GranTurismOgre.cpp (h for reverse)
_vehicle->setInputs(mKeyboard->isKeyDown(OIS::KC_J),
mKeyboard->isKeyDown(OIS::KC_L),
mKeyboard->isKeyDown(OIS::KC_I),
mKeyboard->isKeyDown(OIS::KC_K),
mKeyboard->isKeyDown(OIS::KC_H));
SimpleScenes_Buggy.h
vehicle->setInputs(input->isKeyDown(OIS::KC_J),input->isKeyDown(OIS::KC_L),input->isKeyDown(OIS::KC_I),input->isKeyDown(OIS::KC_K),input->isKeyDown(OIS::KC_K));