NxOgre::Scene->getCharacter ? =(

s0lidnuts

11-07-2007 22:10:18

Well.. I need to get the char from other function, how coul I do it ?

betajaen

11-07-2007 22:12:07

mWorld->getCharacterController()->get("nameOfCharacter");

s0lidnuts

11-07-2007 22:13:42

Geez, are you a robot? o_O
Thanks ^^

betajaen

11-07-2007 22:15:16

Yes.

s0lidnuts

11-07-2007 22:31:11

nxCharacter->getNode()->attachObject(_sceneMgr->getCamera("Camera01"));
This gives me accessViolation =/
EDIT:
oops, i was forgetting some lines, but the it still gives me an error
Unhandled exception at 0x7c812a5b in Atlas.exe: Microsoft C++ exception: Ogre::InvalidParametersException at memory location 0x0012f6f4..

cooould that be related to some camera parameters?

betajaen

11-07-2007 23:00:36

It might, but did you attach a mesh to the Character, or at least use "createNode()" ?

s0lidnuts

11-07-2007 23:08:47

Yes.
Were you doing your every-day robot Database cleanup ? xD

betajaen

11-07-2007 23:11:07

I was on a break. :D

[Edit]

I missed the conversation here. Check to see if mCamera is actually a Camera. It probably is, but you never know.

Also which one, mCharacter->addMesh or mCharacter->createNode?

[Edit x 2]

For the record this works for me:

Character* mCharacter = mScene->createCharacter("chara", Vector3(0,10,0), "type: capsule, dimension: 0.5 2");
mCharacter->createNode();
mCharacter->getNode()->attachObject(mCamera);

s0lidnuts

11-07-2007 23:19:48

NxOgre::Character *nxCharacter = mNxScene->createCharacter("Player", Ogre::Vector3(-86,109.836,8.432), "type: box, dimensions: 1 1 1");
if (typeid(_sceneMgr->getCamera("Camera01")) == typeid(Ogre::Camera *))
int i = 1;
nxCharacter->createNode();
nxCharacter->attachMesh("Box.mesh");
nxCharacter->getNode()->scale(1, 1, 1);
nxCharacter->getNode()->attachObject(_sceneMgr->getCamera("Camera01"));


and on debug i = 1;

betajaen

11-07-2007 23:20:48

Try:

NxOgre::Character *nxCharacter = mNxScene->createCharacter("Player", Ogre::Vector3(-86,109.836,8.432), "type: box, dimensions: 1 1 1");
if (typeid(_sceneMgr->getCamera("Camera01")) == typeid(Ogre::Camera *))
int i = 1;
nxCharacter->attachMesh("Box.mesh");
nxCharacter->getNode()->scale(1, 1, 1);
nxCharacter->getNode()->attachObject(_sceneMgr->getCamera("Camera01"));


I think it's creating the Node twice.


[Edit]

I used your code in SpongeCake, and it works for me.

NxOgre::Character *nxCharacter = mScene->createCharacter("Player", Ogre::Vector3(-86,109.836,8.432), "type: box, dimensions: 1 1 1");

nxCharacter->attachMesh("cube.1m.mesh");
nxCharacter->getNode()->scale(1, 1, 1);
nxCharacter->getNode()->attachObject(mSceneMgr->getCamera("Main"));

s0lidnuts

11-07-2007 23:53:32

I'm starting to think the libs doesn't like me ^^
mRenderWnd->addViewport(mRoot->getSceneManager("SceneManagerInstance1")->getCamera("PlayerCam"));

Unhandled exception at 0x7c812a5b in Atlas.exe: Microsoft C++ exception: Ogre::ItemIdentityException at memory location 0x0012fe40..

betajaen

11-07-2007 23:56:51

It looks like it. How about storing the camera into a pointer; mCamera and see if it works then?

If it doesn't, perhaps it's time to post on the main forums.

s0lidnuts

12-07-2007 00:00:24

Yup.. and the pointer is valid..
well, let's go to main forums xD