Creating a SeeSaw

Roundeworld

29-12-2009 08:55:45

I'm trying to create a game for my assignment.

My game consist of a seesaw. However, i'm having some problems.

1) When creating the mPivot ( pyramid shape ), what shape should i use? Example
Eg : For the board, i use CubeShape. What about a pyramid.mesh?
mBoard = mScene->createBody ("board.mesh", new NxOgre::CubeShape (100.0f), Vector3 (0,0,0), "density: 1000.0, Group: BoardGroup");

2)How do i go about joining the board with the pivot.

NxOgre::Body *mBoard = 0;
NxOgre::Body *mPivot = 0;

// create the actor groups to detect collisions between them
NxOgre::ActorGroup * mActorGroupBoard = mScene->createActorGroup ("BoardGroup");
NxOgre::ActorGroup * mActorGroupPivot = mScene->createActorGroup ("PivotGroup");

mBoard = mScene->createBody ("board.mesh", new NxOgre::CubeShape (100.0f), Vector3 (0,0,0), "density: 1000.0, Group: BoardGroup");
mPivot = mScene->createBody ("pyramid.mesh", new NxOgre::?? (50.0f), Vector3 (400,400,400), "density: 0.0001, Group: PivotGroup");

Can anyone help me? Will really appreciate it.

deshan

29-12-2009 09:40:46

1st
I think you can use NxOgre::Convex for the board by creating a board.nxs using flour tool and load it to your application
NxOgre::Mesh* convexMesh;
NxOgre::Convex* convex = new NxOgre::Convex(convexMesh);
mRenderSystem->createBody(convex,...);


2nd
hope this helps
https://www.ogre3d.org/addonforums/view ... =6&t=10502

Roundeworld

29-12-2009 10:58:03

Thanks for your reply.

You mean i won't be able to join 2 .mesh together?

Like joining board.mesh with pyramid.mesh using fixedjoint() func. ><

I'm not really sure how to use the method in the link given by you. =X

betajaen

29-12-2009 11:07:57

You can use a revolute joint so it can pivot.

Also; Why are you using such an old version of NxOgre? 0.9 is it? Bloody Mess is so much better and faster.

Roundeworld

29-12-2009 13:55:08

Hello!

Thanks for your help. By the way, how do you see if it's the old version or new 1? o.O This framework was given by my lecturer.

How does the Bloody Mess look like anyway?

betajaen

29-12-2009 14:01:33

Your using string params, which were deprecated after 1.0. If you was given 0.9 by your lecturer then fair enough, it's just BloodyMess is far better and faster.

Roundeworld

29-12-2009 14:06:40

Hello!

Is there a big difference between the Bloody Mess & the one i'm currently using?

betajaen

29-12-2009 16:20:34

The interface is different, it's newer and supports some of PhysX features better. Also you won't find any documentation for 0.9 anymore, neither does anyone in the forum remember using it.

Personally, I would upgrade, but you should check with your lecturer first.

Roundeworld

30-12-2009 04:12:56

Hello!

Just wondering how do i use the revolutejoint?

NxOgre::JointParams *joint;
NxOgre::RevoluteJoint(Actor*, Actor*, const Ogre::Vector3 &axis, const Ogre::Vector3 &anchor, joint)

The JointParams = JointParams(), what exactly is it? I'm having problems passing things in. ><

Roundeworld

30-12-2009 05:59:35

Does annyone have a new version of the template?

deshan

30-12-2009 06:33:50

this is how create revolute joint
NxOgre::RevoluteJointDescription description;
NxOgre::RevoluteJoint* rjoint = mScene->createRevoluteJoint(rigidBody1, rigidBody2, description);


The article
https://www.ogre3d.org/addonforums/view ... =6&t=10502
contains a revolutejoint example. some time ago i have made a seasow looking joint by using spacegaier example.

Roundeworld

30-12-2009 06:59:35

I've tried creating 2 cubes.

NxOgre::Actor * mCube = 0;
NxOgre::Actor * mCube_2 = 0;

mCube = mScene->createBody("box.mesh",new NxOgre::CubeShape (50.0f),Vector3 (0,0,0), "kinematic:no,dynamic:no,density: 0.0001, Group: BoxGroup");
mCube_2 = mScene->createBody("box.mesh",new NxOgre::CubeShape (50.0f),Vector3 (50,0,0), "kinematic:no,dynamic:no,density: 0.0001, Group: BoxGroup");

NxOgre::RevoluteJoint *joint = mScene->createRevoluteJoint(mCube, mCube_2, Vector3(0,0,0), Vector3(0,0,0), "Group : BoxGroup");

But the 2 cubes doesn't join tgt.

Roundeworld

30-12-2009 08:30:45

I've encountered some other errors. =X

When i try to move the cube that i've created, if i kept moving the cube left & right by holding down the left & right keys, the whole cube will eventually fly away.

mCube = mScene->createBody("box.mesh",new NxOgre::CubeShape (100.0f),Vector3 (0,50,0),"dynamic:no,density: 0.0001, Group: BoxGroup");

if (GetAsyncKeyState (VK_LEFT))
{
Vector3 BBPos = mCube->getGlobalPosition();
BBPos.x-=1;
mCube->setCMassGlobalPosition (Vector3(BBPos.x, BBPos.y, BBPos.z));
}

if (GetAsyncKeyState (VK_RIGHT))
{
Vector3 BBPos = mCube->getGlobalPosition();
BBPos.x+=1;
mCube->setCMassGlobalPosition (Vector3(BBPos.x, BBPos.y, BBPos.z));
}

if (GetAsyncKeyState (VK_UP))
{
Vector3 BBPos = mCube->getGlobalPosition();
BBPos.z-=1;
mCube->setCMassGlobalPosition (Vector3(BBPos.x, BBPos.y, BBPos.z));
}

if (GetAsyncKeyState (VK_DOWN))
{
Vector3 BBPos = mCube->getGlobalPosition();
BBPos.z+=1;
mCube->setCMassGlobalPosition (Vector3(BBPos.x, BBPos.y, BBPos.z));
}

Is there anything that i should add to prevent this from happening?