how to get the position of a SimpleVehicle

jaxx0rr

15-08-2007 09:34:45

I've modified the Demo05_SimpleVehicle tutorial and I'm trying to attach a camera to the car in the framestarted function. I tried several methods but they are all wrong obviously..

// Ogre::Vector3 vpos = mCar->getWorldPosition();
// Ogre::Vector3 cpos = mCar.position();
// Ogre::Vector3 cpos = mCar.getPosition();

msnCam->setPosition( cpos.x-20.0, cpos.y+1, cpos.z);


also..

when I added new meshes for the car and wheels the shadows dissapeared
is it because they are too complex?

EDIT: I kind of fixed the shadow problem.. I discovered that only this type of shadow works: SHADOWTYPE_TEXTURE_MODULATIVE
Still dont know if it's because the meshes are too complex or some other reason

jaxx0rr

16-08-2007 06:25:39

sorry for the double post but I'm desperate :(

beside the stuff above I cant debug my prog in realtime because I cant get cegui to work.. even the tutorial gives me this error:

------ Build started: Project: tutorial7, Configuration: Release Win32 ------
Compiling...
main.cpp
Linking...
main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall CEGUI::System::injectChar(unsigned int)" (__imp_?injectChar@System@CEGUI@@QAE_NI@Z)
main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall CEGUI::System::injectKeyUp(unsigned int)" (__imp_?injectKeyUp@System@CEGUI@@QAE_NI@Z)

.........
.........
.........

main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: float __thiscall CEGUI::Rect::getWidth(void)const " (__imp_?getWidth@Rect@CEGUI@@QBEMXZ)
bin\Release\tutorial7.exe : fatal error LNK1120: 71 unresolved externals
Build log was saved at "file://c:\Users\Jaxx\Documents\Visual Studio 2005\Projects\tutorial7\tutorial7\obj\Release\BuildLog.htm"
tutorial7 - 72 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


and yes, I linked all the right files

this is the project (source code + binaries)
please help me

EDIT: I FIXED THIS!! :)

for anyone in my situation:
Go to Project -> Properties

1. C/C++ / General / Add. Incl. Dir.
this should be:
$(OGRE_HOME)\include;$(OGRE_HOME)\include\CEGUI;$(OGRE_HOME)\samples\include

2. Linker / General / Add. Lib. Dir.
this should be:
$(OGRE_HOME)\lib

3. Linker / Input / Aditional Dependencies
this should be:
OgreMain_d.lib OIS_d.lib CEGUIBase_d.lib OgreGUIRenderer_d.lib

.. if it still not works $(OGRE_HOME) might not be set.. try replacing it with the acutal path C:\OGRE_SDK

walaber

17-08-2007 00:55:03

to get the position of a vehicle, do this:


Ogre::Vector3 position;
Ogre::Quaternion orient;

mCar->getChassisBody()->getPositionOrientation(position, orient);

jaxx0rr

17-08-2007 07:27:25

Thanks walaber.
But now I have another problem :)
The car (or camera) is shaking like crazy...
http://jaxx.upcnet.ro/other/camera_shake.avi
http://jaxx.upcnet.ro/other/camera_shake2.avi
Funny thing is .. with Fraps it doesn't shake asmutch..

Drakon

17-08-2007 10:11:21

I had the same problem...

I changed parameter in
mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mSceneMgr, m_World, 60 );

from 60 to higher value ex. 150 and camera was working ok.

jaxx0rr

17-08-2007 11:53:45

it doesn't seem to help but rather slowing .. @ 300 it's like slow motion but the shake still continues..
I've read somewhere in the forum a similar problem.. and I think it has got to do with the camera updating a frame later than the car.