[Solved] Problem on createBody once upgraded to 1.0 '22T5

gbisocoli

24-04-2009 18:54:00

I get this:

1>f:\mis documentos\visual studio 2008\projects\soccer\src\actors.cpp(81) : error C2783: 'NxOgre::Actor *NxOgre::Scene::createBody(const NxOgre::NxString &,NxOgre::Shape *,const NxOgre::Pose &,const NxOgre::NodeRenderableParams &,const NxOgre::ActorParams &)' : could not deduce template argument for 'BodyClass'
1> d:\ides\nxogre\include\nxogrescene.h(439) : see declaration of 'NxOgre::Scene::createBody'
1>f:\mis documentos\visual studio 2008\projects\soccer\src\actors.cpp(81) : error C2780: 'NxOgre::Actor *NxOgre::Scene::createBody(const NxOgre::VisualIdentifier &,NxOgre::Shape *,const NxOgre::Pose &,const NxOgre::ActorParams &)' : expects 4 arguments - 5 provided
1> d:\ides\nxogre\include\nxogrescene.h(417) : see declaration of 'NxOgre::Scene::createBody'


the code is:

void Player::createBody(Vector3 pos, float scale)
{
// create node renderable parms for body
NodeRenderableParams nrp;
nrp.setToDefault();
nrp.mIdentifierUsage = NxOgre::NodeRenderableParams::IU_Use;
nrp.mIdentifier = mNode->getName();
// create body (name,shape,position,node renderable params,actor params)
// actor params is for example mass
mBody = mNxScene->createBody(name+"_body",new Cube(scale*2),pos,nrp,"mass:21"); // <--Here
}


I look into NxOgreBody.h and:

/** \brief Body constructor with full visualisation.
\example
<code>
mSceneMgr->createBody("myBody", new CubeShape(2,2,2), Vector3(0,5,0), "model: cube.1m.mesh, scale: 2 2 2", "mass: 10");
</code>
*/
Body(const NxString&, Scene*, Shape*, const Pose&, const NodeRenderableParams&, const ActorParams&);


What's going on?

Fred

24-04-2009 19:09:33

You have to use something like: scene->createBody<NxOgre::Body>(const NxOgre::NxString &,NxOgre::Shape *,const NxOgre::Pose &,const NxOgre::NodeRenderableParams &,const NxOgre::ActorParams &)

This should work

gbisocoli

25-04-2009 02:52:16

You have to use something like: scene->createBody<NxOgre::Body>(const NxOgre::NxString &,NxOgre::Shape *,const NxOgre::Pose &,const NxOgre::NodeRenderableParams &,const NxOgre::ActorParams &)

This should work

I did like you said:

scene->createBody<NxOgre::Body>(const NxOgre::NxString &,NxOgre::Shape *,const NxOgre::Pose &,const NxOgre::NodeRenderableParams &,const NxOgre::ActorParams &)

scene = mNxScene - OK
const NxOgre::NxString & = name+"_body" - OK
NxOgre::Shape * = new Cube(scale*2) - OK
const NxOgre::Pose & = pos - OK
const NxOgre::NodeRenderableParams & = nrp - OK
const NxOgre::ActorParams & = "mass:21" - I thought this may be the problem so I changed it to this:

void Ball::createBody(Vector3 pos, float scale)
{
NodeRenderableParams nrp;
nrp.setToDefault();
nrp.mIdentifierUsage = NxOgre::NodeRenderableParams::IU_Use;
nrp.mIdentifier = mNode->getName();
NxOgre::Pose p= NxOgre::Pose(pos); // changed
ActorParams ap; // changed
ap.setToDefault(); // changed
ap.mMass = 0.43; // changed
mBody = mNxScene->createBody(name+"_body",new NxOgre::Sphere(scale*2),p,nrp,ap); // changed - now I send an NxOgre::ActorParams object (ap) instead of a string.
}


I still get the same log. :?

Fred

25-04-2009 11:09:58

Ehm I think you missunderstood me ;)

You have to change this line of your code:mBody = mNxScene->createBody(name+"_body",new NxOgre::Sphere(scale*2),p,nrp,ap);
into this:mBody = mNxScene->createBody<NxOgre::Body>(name+"_body",new NxOgre::Sphere(scale*2),p,nrp,ap);
Maybe you also have to cast the body: mBody = static_cast<NxOgre::Body*>(mNxScene->createBody<NxOgre::Body>(name+"_body",new NxOgre::Sphere(scale*2),p,nrp,ap));

I hope this will help ;)

gbisocoli

25-04-2009 17:28:10

Thanks! That did it!
On a (near) future I'll start using Actors instead of Bodies. If someone have some document on how to do it, I'll appreciate the info. Thanks!

-Solved-