input keyboard

zolver

16-12-2010 08:01:34

Hi, there...

I wanna give interaction with my NxOgre application from input keyboard, like NxOgre Tutorials - 111 - Dynamic CCD. I copy & paste this code to class of my application.

bool keyPressed(const OIS::KeyEvent& evt)
{
if (evt.key == OIS::KC_SPACE)
{
Vec3 force(mCamera->getDirection());
force *= 50;
mBody->setGlobalPosition(Vec3(mCamera->getPosition()));
mBody->setLinearVelocity(force);
}


But, while I compiled I got this error

1>c:\dev\projects\nxogre\rc1\rc1.cpp(147) : error C2059: syntax error : 'string'
1>c:\dev\projects\nxogre\rc1\rc1.cpp(147) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>c:\dev\projects\nxogre\rc1\rc1.cpp(176) : fatal error C1075: end of file found before the left brace '{' at 'c:\dev\projects\nxogre\rc1\rc1.cpp(29)' was matched


How I can fix it?

zolver

16-12-2010 08:46:53

Then, I use from Spacegaier Tutorial, http://www.ogre3d.org/tikiwiki/BloodyMess+Tutorial+5#Let_s_shoot_them format.

class BloodyMessTutorial2 : public ExampleApplication, public NxOgre::Callback
{
protected:
.....................
OIS::Keyboard* mKeyboard;

void createScene()
{
.......................
if(mKeyboard->isKeyDown(OIS::KC_SPACE))
{
NxOgre::Vec3 force(mCamera->getDirection());
force *= 50;
mBody->setGlobalPosition(NxOgre::Vec3(mCamera->getPosition()));
mBody->setLinearVelocity(force);
}
........................


I succeeded to compile it. But, when I running the application, I got this error from Ogre.log file.
15:37:09: Parsing script Background.material
15:37:09: Parsing script Examples.material
15:37:10: OGRE EXCEPTION(2:InvalidParametersException): Parameter called camObjPos does not exist. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1433)
15:37:10: Compiler error: invalid parameters in Examples.material(837): setting of constant failed


Any Solution?