[SOLVED] Realization of a simple soccer goal

spacegaier

13-03-2008 20:47:01

A logic question:

I habe a mesh (look at the following drawing) that represents my goal for a simple fun soccer game. In interior of the goal should be filled with a trigger to count the goals.



If I set the shape of the goal as no collision shape all is fine as the ball can go throught the mesh into the trigger. But that is really unrealistic as the ball can go trought the piles of the goal either. That should be abolished.

So what can I do to reach this? Of course I can split up the goal into three smaller meshes (wo piles and one cross pile). But isn't there an easier / better way?

betajaen

13-03-2008 21:03:09

Three CubeShapes in a CompoundShape in an Actor.

spacegaier

13-03-2008 21:44:21

I've got now the following code:

NxOgre::CubeShape *pile1Goal1 = new NxOgre::CubeShape(1, goalSize.y-1, goalSize.z);
NxOgre::CubeShape *pile2Goal1 = new NxOgre::CubeShape(1, goalSize.y-1, goalSize.z);
NxOgre::CubeShape *cross_pileGoal1 = new NxOgre::CubeShape(goalSize.x, 1, goalSize.z);
NxOgre::CubeShape *pile1Goal2 = new NxOgre::CubeShape(1, goalSize.y-1, goalSize.z);
NxOgre::CubeShape *pile2Goal2 = new NxOgre::CubeShape(1, goalSize.y-1, goalSize.z);
NxOgre::CubeShape *cross_pileGoal2 = new NxOgre::CubeShape(goalSize.x, 1, goalSize.z);
NxOgre::Trigger *trigger1 = m_pNxScene->createTrigger("trigger1", new NxOgre::CompoundShape(pile1Goal1, pile2Goal1, cross_pileGoal1), NxOgre::Pose(Vector3(goalPosition1.x-1, goalPosition1.y-0.5, goalPosition1.z), goalQuat1), "static: yes");
NxOgre::Trigger *trigger2 = m_pNxScene->createTrigger("trigger2", new NxOgre::CompoundShape(pile1Goal2, pile2Goal2, cross_pileGoal2), NxOgre::Pose(Vector3(goalPosition2.x-1, goalPosition2.y-0.5, goalPosition2.z), goalQuat2), "static: yes");


Now, I've seen that I can define offsets for each shape. To what to they refer (to what / which point is that offset)?

spacegaier

14-03-2008 21:13:52

Is it to the center of the mesh of the first named Shape?

And what is the fastest and easiest way to visualize the trigger? Is there a possibility without creating a mesh?

betajaen

14-03-2008 21:30:26

Center to the actor. Say your shape is -1 on the local axis, and the Actor is at 15 on the global, then the shape is 14.