0.9 porting issues

jchmack

13-05-2007 21:37:57


1)how do i get the old world singleton?


World::getSingleton().showDebugOverlay(mSceneMgr->getCurrentViewport()->getCamera(), mWindow);
World::getSingleton().debug( world::getSingleton().isDebugRendering() ^ 1);
World::getSingleton().setTimeModifer(speed);


1>.\NXOgreAbstractor.cpp(490) : error C2039: 'getSingleton' : is not a member of 'NxOgre::World'
1> c:\documents and settings\julius abella\desktop\game4\nxogre\include\NxOgreWorld.h(11) : see declaration of 'NxOgre::World'

2) Is NxTools Gone?

NxTools::convert(targetBody->................

error C2653: 'NxTools' : is not a class or namespace name

3) New raycaster issues

Body *t = mRayCaster->mHitBody;

>.\NXOgreAbstractor.cpp(683) : error C2039: 'mHitBody' : is not a member of 'NxOgre::RayCaster'

betajaen

13-05-2007 22:06:26

1. World is no longer a singleton.
1a. No Debug Overlay or Debug Overlay - ever.
1b. Ditto.
1c. Not at the moment, will be in the future.

2. Nope, it's now split into seperate functions; toNxVec3, toVector3, toNxQuat and toQuat.

3. http://www.ogre3d.org/phpBB2addons/view ... 4774#24774

jchmack

13-05-2007 22:31:23


2. Nope, it's now split into seperate functions; toNxVec3, toVector3, toNxQuat and toQuat.


hmm im not exactly sure how to port this line:

force -= NxTools::convert(targetBody->mActor->getPointVelocity(NxTools::convert(targetBody->getGlobalPosition())));

its from your mouseMoveOrGrab function

also how do i get the closest body from a raycast:

im seeing a getclosest actor but not a body:
Body *t = mRayCaster->getClosestActor();

i suspect i get the body from the actor somehow.

betajaen

13-05-2007 22:36:45

force -= mBody->getPointVelocity(mBody->getGlobalPosition());


But if I think what that piece of code is, then just use this for that entire code block.

mBody->moveTowards(WhereEverYouWant);

It is the closest body; A body is an actor. Bodies are just actors with a SceneNode.


See?

class NxExport Body : public Actor {

public:

Body(const NxString& name, Scene*, ShapeDescription*, const Pose&, ActorParams = "");
virtual ~Body();

Ogre::SceneNode* getNode(){return mNode;}
Ogre::Entity* getEntity(){return mEntity;}
void setNode(Ogre::SceneNode*);
void setEntity(Ogre::Entity*);
void simulate(float);
void render(float);

protected:

Ogre::SceneNode* mNode;

// Could be changed to a collection of entities.
Ogre::Entity* mEntity;

};


:D

jchmack

13-05-2007 23:01:14


It is the closest body; A body is an actor. Bodies are just actors with a SceneNode.


Body *t = mRayCaster->getClosestActor();

error C2440: 'initializing' : cannot convert from 'NxOgre::Actor *' to 'NxOgre::Body *'
1> Cast from base to derived requires dynamic_cast or static_cast

what am i doing wrong?

also How do i create groups now:

mScene->createGroup("Players");

error C2039: 'createGroup' : is not a member of 'NxOgre::Scene'

betajaen

13-05-2007 23:10:24

Do:

Actor* t = mRayCaster->getClosestActor(); or:
Body* t = static_cast<Body*>(mRayCaster->getClosestActor());

Groups not implemented yet.

jchmack

13-05-2007 23:28:20

were getting there lol. I'm hoping that this will serve as a good porting guide too =).

Has character creation changed a lot?

blueprint<character> bp;

1>.\GameCharacter.cpp(39) : error C2065: 'blueprint' : undeclared identifier
1>.\GameCharacter.cpp(39) : error C2065: 'character' : undeclared identifier

from what i'm seeing in intelisense blueprints are gone?

jchmack

13-05-2007 23:47:08

from what im getting the new character creation went from:

blueprint<character> bp;
bp.setToDefault();
bp.setGravity(false);
bp.setSlopeLimit(45);
bp.setStep(0.3);
bp.setShapeAsCapsule(CharacterRadius,CharacterHeight);
bp.setMesh("");

mCharacter = bp.create(name,InitialPosition,mScene);



to

mCharacter = new NxOgre::Character(name,mScene, SOMETHING ,InitialPosition,I_DONT_KNOW_THE_PARAMS_FORMAT_YET );

ANdys

14-05-2007 04:56:36

That's my try~~~

CreateScene:
Character* player = mScene->createCharacter("one", Vector3(5,120,7),"Mass: 10");

player->attachMesh("cube.1m.mesh");

it creates a Character with cube.1m.mesh.


and if you want to simple move,add this ↓ to frameStarted to test
FrameStarted: Character* player = mWorld->getCharacterController()->get("one");

if (mKeyboard->isKeyDown(OIS::KC_I))
{
   player->addMovement(Character::DR_Forward);
}

jchmack

14-05-2007 15:31:42

thank you i got it to work (well compile at least for now) :lol: .

down to Last 3 errors:

1) I used to set my characters position (after creation) like this:

void GameCharacter::SetPosition(Vector3 Position)
{
NxExtendedVec3 NXPosition(Position.x,Position.y,Position.z);
mCharacter->mController->setPosition(NXPosition);
}


but now mController isn't part of the character class anymore... can i not set the position of my characters after creation now?

For anyone asking, I have this here for networking purposes to update a character who changed directions a while back. In the future i plan to interpolate this but for now i will just teleport them to the accurate spot.

2) I cant get the age of a body anymore...

if((*iter)->mBody->getAge()>(*iter)->LifeTime)

1>.\ProjectileManager.cpp(477) : error C2039: 'getAge' : is not a member of 'NxOgre::Body'
1> c:\documents and settings\julius abella\desktop\game4\nxogre\include\NxOgreBody.h(9) : see declaration of 'NxOgre::Body'


3) I cant chage the Ignore gravity flag.

(*iter)->mBody->setIgnoreGravity(false);

1>.\ProjectileManager.cpp(533) : error C2039: 'setIgnoreGravity' : is not a member of 'NxOgre::Body'
1> c:\documents and settings\julius abella\desktop\game4\nxogre\include\NxOgreBody.h(9) : see declaration of 'NxOgre::Body'

My best guess is that its part of params now but i didn't see it in your sticky guide and i also need to access it dynamically not just at creation. Can I do that...? Access the params class dynamically?

betajaen

14-05-2007 16:06:32

In the next SVN commit, you can access it via: mCharacter->getNxController();

But I'll add SetPosition as well - it makes sense.

jchmack

14-05-2007 16:12:21

Bah i always miss you while im editing (see above)

In the next SVN commit, you can access it via: mCharacter->getNxController();

But I'll add SetPosition as well - it makes sense.


thanks a ton :D

betajaen

14-05-2007 16:21:14

You must remember that NxOgre 0.9 is half-written. It compiles and works, but half-written the same.

jchmack

14-05-2007 16:31:28

You must remember that NxOgre 0.9 is half-written. It compiles and works, but half-written the same.

true... Guess im feeling lazy... all of those are things I "could" do. I just figured I would ask you before i dive into your code. No need to re-invent the wheel. Lack of school makes me apathetic.

Well 3 errors is almost a perfect port. Especially for a half written version. From what i see 0.9 looks wonderful. Keep up the good work.

jchmack

14-05-2007 17:13:54

guess I will post my patches for anyone else who might not want to wait for the next SVN

to move a character:
// NxOgreCharacter.h
NxController* getNxController() {return mCharacter;} // line 64

then use:

void GameCharacter::SetPosition(Vector3 Position)
{
NxExtendedVec3 NXPosition(Position.x,Position.y,Position.z);
mCharacter->getNxController()->setPosition(NXPosition);
}


to ignore gravity:
mBody->setIgnoreGravity(true);
becomes
mActor->raiseBodyFlag(NX_BF_DISABLE_GRAVITY);

and vice versa:

mBody->setIgnoreGravity(false);
becomes mBody->getNxActor()->clearBodyFlag(NX_BF_DISABLE_GRAVITY);

as for age ill just keep track of it myself

Hope this helps somebody. Thanks to betajaen/ANdys for all the help.