huaner
02-07-2007 03:53:58
Hi:
i use Physx 2.7, NxOgre.0.4.RC3, Ogre1.2.4; but when i compile it , there many errors. for example:
nxogre\include\nxogre_includes.h(53) : error C2371: 'NxControllerManager' : redefinition; different basic types
v2.7.0\sdks\nxcharacter\include\nxcontrollermanager.h(31) : see declaration of 'NxControllerManager'
nxogre\include\nxogre_includes.h(285) : error C2259: 'NxControllerManager' : cannot instantiate abstract class due to following members:'NxU32 NxControllerManager::getNbControllers(void) const' : is abstract
nxogre\include\nxogre_includes.h(285) : error C2259: 'NxControllerManager' : cannot instantiate abstract class due to following members:
error C2248: 'NxControllerManager::~NxControllerManager' : cannot access protected member declared in class 'NxControllerManager'
nxogre\source\nxogre_world.cpp(291) : error C2065: 'NX_VISUALIZE_BODY_LIN_MOMENTUM' : undeclared identifier
nxogre\source\nxogre_world.cpp(292) : error C2065: 'NX_VISUALIZE_BODY_ANG_MOMENTUM' : undeclared identifier
nxogre\source\nxogre_world.cpp(293) : error C2065: 'NX_VISUALIZE_BODY_LIN_ACCEL' : undeclared identifier
nxogre\source\nxogre_world.cpp(294) : error C2065: 'NX_VISUALIZE_BODY_ANG_ACCEL' : undeclared identifier
nxogre\source\nxogre_world.cpp(295) : error C2065: 'NX_VISUALIZE_BODY_LIN_FORCE' : undeclared identifier
nxogre\source\nxogre_world.cpp(296) : error C2065: 'NX_VISUALIZE_BODY_ANG_FORCE' : undeclared identifier
nxogre\source\nxogre_world.cpp(297) : error C2065: 'NX_VISUALIZE_BODY_REDUCED' : undeclared identifier
nxogre\source\nxogre_world.cpp(299) : error C2065: 'NX_VISUALIZE_BODY_CONTACT_LIST' : undeclared identifier
nxogre\source\nxogre_world.cpp(300) : error C2065: 'NX_VISUALIZE_BODY_JOINT_LIST' : undeclared identifier
nxogre\source\nxogre_world.cpp(301) : error C2065: 'NX_VISUALIZE_BODY_DAMPING' : undeclared identifier
nxogre\source\nxogre_world.cpp(302) : error C2065: 'NX_VISUALIZE_BODY_SLEEP' : undeclared identifier
nxogre\source\nxogre_world.cpp(306) : error C2065: 'NX_VISUALIZE_JOINT_ERROR' : undeclared identifier
nxogre\source\nxogre_world.cpp(307) : error C2065: 'NX_VISUALIZE_JOINT_FORCE' : undeclared identifier
nxogre\source\nxogre_world.cpp(308) : error C2065: 'NX_VISUALIZE_JOINT_REDUCED' : undeclared identifier
how to deal it ? and there is something wrong about version?
thank you very much!
betajaen
02-07-2007 09:17:11
Yes. Don't use PhysX 2.7.x with 0.4.RC3
frier
02-07-2007 13:06:05
Yeah i had that problem ealier today and found these capability issues... i'm using nxOGRE 0.9.
I'm getting this error, and i dont want to start a new thread.
Error 1 fatal error LNK1107: invalid or corrupt file: cannot read at 0x310 C:\dev\NxOgre\lib\NxOgre_d.dll 1
frier
02-07-2007 13:46:40
Yep rebuilding worked, after a reboot(werid)
Now im getting a:
Unhandled exception at 0x00dbf8b5 (NxOgre_d.dll) in Crawlers.exe:
i saw a therad previously about another line of code causing this problem
"mScene->createBody" i think it was.. now im getting it when this piece of code is ran:
bool FixedSceneController::Simulate(NxReal deltaTime) {
mTiming_CurrentStep += deltaTime;
if (mTiming_CurrentStep < mTiming_MaxStep) {
mRenderFrame = false;
return false;
}
mNxScene->simulate(mTiming_MaxStep - (mTiming_MaxStep - mTiming_CurrentStep)); //<----- here
mNxScene->flushStream();
mNxScene->fetchResults(NX_RIGID_BODY_FINISHED, false);
mRenderFrame = true;
mTiming_CurrentStep=0;
return true;
}
betajaen
02-07-2007 14:07:33
Weird. It might be because of Dagon. (We use Eihort around these parts).
But for now, you can cheat and change it to:
mNxScene->simulate(1.0f/60.0f);
frier
02-07-2007 14:37:20
yeah im using Eihort. That previous code was in
"NxOgreSceneController.cpp" hmmm
Im not calling that function directly.. it must call it internally to nxOgre? not sure :S.
These are the only two things im doing in my framelistener.
// 1. Start up NxOgre and pass on Ogre Root and the SceneManager as arguments.
mWorld = new NxOgre::World();
// 2. Create our scene, this is where the physics is simulated into.
// We can have more than one scene, but physics objects of one scene
// cannot interact with another scene.
mScene = mWorld->createScene("Main",mSceneMgr);
betajaen
02-07-2007 14:41:09
It's fine. Just change the code and it should work.
huaner
02-07-2007 14:45:40
Yes. Don't use PhysX 2.7.x with 0.4.RC3
first, thank you for your reply. but PhysX 2.7.x with which version?
thanks
frier
02-07-2007 14:49:35
Ok it went past that part. And just crashed at the next internal simulate method. so i changed all the simulates to (1.0f/60.0f).
Now its finally crashing in the
bool Root::_fireFrameStarted(FrameEvent& evt)
in ogreroot.cpp
Unhandled exception at 0x00dbf8b5 (NxOgre_d.dll)
for (i= mFrameListeners.begin(); i != mFrameListeners.end(); ++i)
{
if (!(*i)->frameStarted(evt)) <---- crashes here
return false;
}
betajaen
02-07-2007 14:54:36
Let's have a look at your application code.
frier
02-07-2007 15:01:03
Ok ill upload the entire thing.
betajaen
02-07-2007 15:16:42
I was just referring to the NxOgre setup and framelistener code. If your making Ogre crash than something is really wrong.
frier
02-07-2007 15:19:01
Think it might be my nxogre_d.dll. dunno :S
heres my code.
http://www.infernal-chaos.com/Crawlers/Crawlers.zip
Oh the Framelistener code.. doesnt do much in the way of nxOgre.. just creates some variables and instanciates them?
#ifndef myFrameListener_H
#define myFrameListener_H
/**
This class Controls the player and camera movement. It does this by passing current keyboard and mouse states over to
the initalised pointers of the player and extended camera class.
*/
#include <Ogre.h>
#include <OgreStringConverter.h>
#include <OgreException.h>
//#include <OgreFrameListener.h>
#include "Player.h"
#include "ExtendedCamera.h"
#include "InputManager.h"
#include <nxOgre.h>
using namespace Ogre;
class myFrameListener: public FrameListener{
private:
OIS::Keyboard *mKeyboard;
OIS::Mouse *mMouse;
int mCount;
/** nxOGre */
//NxOgre::World *mWorld; /* is everything, inifinate ammount of space. can only have one*/
//NxOgre::Scene *mScene; /* seems to be like a worl but can make MORE THEN ONE. Different scene bodys cannont interact with each other*/
//NxOgre::Body *myCube; /* The object what will have physics applied upon it */
protected:
// References to the main character and the camera
Player *mPlayer;
Ogre::Camera *mCamera;
ExtendedCamera *mExtCamera;
Ogre::RenderWindow *renderWindow;
Degree mRotateSpeed;
Degree mRotScale;
Ogre::RaySceneQuery *mRaySceneQuery; // The ray scene query pointer
Ogre::SceneManager* mSceneMgr;
Ogre::SceneNode *mCurrentObject;
// Camera mode - Now supports 1st person, 3rd person (chasing) and 3rd person (fixed)
unsigned int mMode;
public:
myFrameListener(Ogre::SceneManager* pSceneManager, Ogre::Camera *pCamera, OIS::Mouse *pMouse) : mSceneMgr(pSceneManager), mCamera(pCamera), mRotateSpeed(36)//,mMouse(pMouse)
{
mCamera = pCamera;
//renderWindow = pRenderWindow; // DOnt think i need this
mPlayer = 0;
mExtCamera = 0;
mMode = 0;
mKeyboard = InputManager::getSingletonPtr()->getKeyboard();
mMouse = InputManager::getSingletonPtr()->getMouse();
mRaySceneQuery = mSceneMgr->createRayQuery(Ogre::Ray());
// 1. Start up NxOgre and pass on Ogre Root and the SceneManager as arguments.
mWorld = new NxOgre::World();
// 2. Create our scene, this is where the physics is simulated into.
// We can have more than one scene, but physics objects of one scene
// cannot interact with another scene.
mScene = mWorld->createScene("Main",mSceneMgr);
// 3. Better add some gravity.
//mScene->hasGravity();
//mScene->setGravity(Ogre::Vector3(0.0f,-1.0f,0.0f));
// 4. Let's add a floor.
// Floors have an infinite size so we don't have to worry about anything
// falling off!
//mScene->hasFloor();
//mScene->addFloor();
// 5. Create another cube.
//myCube = mScene->createBody(
// "myCube", // Name of the body
// "cube.1m.mesh", // Mesh to use
// new cubeShape(1), // Collision model
// 1.0f, // Density
// pose( // Pose it:-
// Vector3(-3,0.5,3), // Put it at -3, 0.5, 3
// Quaternion(Radian(Degree(45)),Vector3::UNIT_Y) // Rotate it 45 degrees on the Y axis
// )
//);
//myCube = mScene->createBody("myCube",new NxOgre::CubeShape(1),NxOgre::Pose(Vector3(-3,0.5,3),Quaternion(Radian(Degree(45)),Vector3::UNIT_Y)));
//myCube=mScene->createBody("cube.1m.mesh", new NxOgre::PrismShape(1.0f,1.0f,1.0), Ogre::Vector3(0,10.25f,0.0f), "Mass: 100, node-scale: 1 ");
}
~myFrameListener(){
delete mRaySceneQuery;
}
void setCharacter (Player *pPlayer) {
mPlayer = pPlayer;
}
void setExtendedCamera (ExtendedCamera *pExtCamera) {
mExtCamera = pExtCamera;
}
bool frameEnded(const FrameEvent& evt){
return true;
}
bool frameStarted(const FrameEvent& evt)
{
//mKeyboard->capture();
//mMouse->capture();
if (mPlayer) {
mPlayer->HandleEvents(evt.timeSinceLastFrame, mKeyboard, mMouse);
if (mExtCamera) {
switch (mMode) {
case 0: // 3rd person chase
mExtCamera->update (evt.timeSinceLastFrame,
mPlayer->getCameraNode ()->getWorldPosition (),
mPlayer->getSightNode ()->getWorldPosition ());
break;
case 1: // 3rd person fixed
mExtCamera->update (evt.timeSinceLastFrame,
Vector3 (0, 200, 0),
mPlayer->getSightNode ()->getWorldPosition ());
break;
case 2: // 1st person
mExtCamera->update (evt.timeSinceLastFrame,
mPlayer->getWorldPosition (),
mPlayer->getSightNode ()->getWorldPosition ());
break;
}
}
}
// 3rd Person - Chase Camera
if (mKeyboard->isKeyDown (OIS::KC_F1)) {
mMode = 0;
if (mPlayer)
mPlayer->setVisible (true); //static_cast<OgreCharacter *>(mPlayer)->setVisible (true);
if (mExtCamera) {
if (mPlayer)
mExtCamera->instantUpdate (mPlayer->getCameraNode ()->getWorldPosition (), mPlayer->getSightNode ()->getWorldPosition ());
mExtCamera->setTightness (0.90f);
}
}
// 3rd Person - Fixed Camera
if (mKeyboard->isKeyDown(OIS::KC_F2)) {
mMode = 1;
if (mPlayer)
mPlayer->setVisible(true);
if (mExtCamera) {
if (mPlayer)
mExtCamera->instantUpdate (Vector3 (0, 200, 0), mPlayer->getSightNode ()->getWorldPosition ());
mExtCamera->setTightness (0.01f);
}
}
// 1st Person
if (mKeyboard->isKeyDown (OIS::KC_F3)) {
mMode = 2;
if (mPlayer)
//mPlayer->setVisible (false);//static_cast<OgreCharacter *>(mPlayer)->setVisible (false);
if (mExtCamera) {
if (mPlayer)
mExtCamera->instantUpdate (mPlayer->getWorldPosition(), mPlayer->getSightNode ()->getWorldPosition ());
mExtCamera->setTightness (1.0f);
}
}
if(mMouse->getMouseState().buttonDown(OIS::MB_Left)){
// Setup the ray scene query, use CEGUI's mouse position
Ogre::Ray mouseRay = mCamera->getCameraToViewportRay(mMouse->getMouseState().X.abs / float(mMouse->getMouseState().width), mMouse->getMouseState().Y.abs / float(mMouse->getMouseState().height) );
//Ogre::Ray mouseRay = mCamera->getCameraToViewportRay((mMouse->getMouseState().width,mMouse->getMouseState().height);
mRaySceneQuery->setRay( mouseRay );
// Execute query
RaySceneQueryResult &result = mRaySceneQuery->execute();
RaySceneQueryResult::iterator itr = result.begin( );
// Get results, create a node/entity on the position
if ( itr != result.end() && itr->worldFragment )
{
char name[16];
sprintf( name, "Robot%d", mCount++ );
Entity *ent = mSceneMgr->createEntity( name, "robot.mesh" );
mCurrentObject = mSceneMgr->getRootSceneNode( )->createChildSceneNode( String(name) + "Node", itr->worldFragment->singleIntersection );
mCurrentObject->attachObject( ent );
mCurrentObject->setScale( 0.1f, 0.1f, 0.1f );
}
//mLMouseDown = true;
}
return true;
}
};
#endif
betajaen
02-07-2007 15:37:26
I got your code. You can delete it from your server now:
Before I start going through it would you try this for me?
// 1. Start up NxOgre and pass on Ogre Root and the SceneManager as arguments.
mWorld = new NxOgre::World("framelistener: yes");
// 2. Create our scene, this is where the physics is simulated into.
// We can have more than one scene, but physics objects of one scene
// cannot interact with another scene.
mScene = mWorld->createScene("Main",mSceneMgr, "floor: yes");
I'm thinking it may be due to the params not being initialized properly.
frier
02-07-2007 15:44:14
Tried that.. still erroring
for (i= mFrameListeners.begin(); i != mFrameListeners.end(); ++i)
{
if (!(*i)->frameStarted(evt)) <-- here
return false;
}
werid!. even when i comment everything to do with nxOgre in my code it complains about the dll
p.s. if it loads to the GUI press "space" to go to where it crashes.
Could it be a dodge debug dll?
frier
02-07-2007 15:50:15
Yeah that error is in OgreRoot.cpp
betajaen
02-07-2007 15:51:20
Then it's your code or Ogre.
I'd recompile both.
frier
02-07-2007 15:53:02
Yeah that error is in OgreRoot.cpp.
You know what its working now... i just fiddled with the lib link.. compiled it. and fidled with the linker more and compiled it again now it works... solar flare must of just passed or somthing.
Sorry for the hassel betajaen!
betajaen
02-07-2007 15:54:15
No worries. I knew it wasn't NxOgre, I've been working on the code constantly for two years. It's unlikely you'd find a bug with it