A few simple questions

tomneo2000

21-09-2009 09:00:53

Ok this might be a simple question.
I use Git version

Now i can create a body every time by press spacebar, so if i press 10 times it will create 10 bodys.
How can i handle each body that is created? Like Ogre can retrieve scene node by name and then you can do any change to that specific object but this way seem not a option for NxOgre.

In Git version there is a OGRE3DRenderSystem which can be used to create a body but in this tutorial http://www.ogre3d.org/wiki/index.php/NxOgre_Tutorial_Simple_Sample it teach me use Scene to create body. Why?

I know actor is not visible until you create body, but how can i attach the body to that actor, so i might just search for that actor and retrieve body do the change, and it seem automatic create a scene node from Ogre scene manager when i call createbody() method without assigned a name why?

If i use ogre scene manager to create a scene node and then attach a entity to it, furthermore i create an actor by NxOgre without create a body. Is this workable? If so how to make relationship between those e.g if actor is in the explosion area then it is pushed into air at same time it might change angle, orientation and position and then have to change object that in ogre scene manager to be exactly as same angle , orientation and position as actor .

betajaen

21-09-2009 10:33:26

Usually you would make a note of them; in a vector or array. There isn't any good lookup functions in NxOgre at the moment, but I'm working on it.

OGRE3DBody is an Actor; It's a class derived from the Actor class. If you look at the source code of OGRE3DRenderSystem, particularly the OGRE3DBody.cpp file

You'll see it has all of the actor capabilities, but has a SceneNode and Entity as member variables. You'll also see it has an advance function which updates the node's position and orientation. This is called by the OGRE3DRenderSystem to all of it's bodies every frame. It's well documented and simple to figure out.

tomneo2000

21-09-2009 13:23:17

so thats why i can't find any function that can find the specific body.
i also enable visual debug to see actor that a create but what is actor actually do it seem like a invisible shape and i can't find any function can do attached a body why need actor i can just only use body all the time without actor.
do you know any function can check specific body is in collision states and return the body that has collision with this body. i think this is need for develop a game.

Also i know Ogre can do the volume selection but you say NxOgre has no concept of Ogre so what if i want to develop RTS game what should i do?

betajaen

21-09-2009 13:51:26

Use punctuation and grammar, you're sentences are bleeding into each other, and I can't make any sense of what you are talking about. If English isn't your first language, then slowly and precisely tell me what you need to know. You can also underneath write what you said in your natural langauge, so if anyone here speaks it, can act as a interpreter for you.

Let's sum this up so a three year old can understand;

- Actors are things like a computer monitor, keyboard, door, car chassis, oil barrel and so on.
- Actors have shape(s).
- A Shape is a Sphere, Box, Capsule or Convex point cloud.
- NxOgre has Actors
- NxOgre makes Actors move, jump and play.
- NxOgre only does physics.
- NxOgre doesn't draw things on the screen.

- OGRE3DRenderSystem draws Bodies on the screen, using Ogre.
- OGRE3DBody or "Body" is half Actor, half SceneNode
- OGRE3DRenderSystem has Bodies
- Body has the magical bits that makes Ogre draw the Actor on the screen.
- NxOgre thinks Bodies are Actors.
- NxOgre can treats Bodies like as Actors.
- NxOgre's functions that use Actors, can use Bodies.

tomneo2000

21-09-2009 16:34:42

Use punctuation and grammar, you're sentences are bleeding into each other, and I can't make any sense of what you are talking about. If English isn't your first language, then slowly and precisely tell me what you need to know. You can also underneath write what you said in your natural langauge, so if anyone here speaks it, can act as a interpreter for you.

Let's sum this up so a three year old can understand;

- Actors are things like a computer monitor, keyboard, door, car chassis, oil barrel and so on.
- Actors have shape(s).
- A Shape is a Sphere, Box, Capsule or Convex point cloud.
- NxOgre has Actors
- NxOgre makes Actors move, jump and play.
- NxOgre only does physics.
- NxOgre doesn't draw things on the screen.

- OGRE3DRenderSystem draws Bodies on the screen, using Ogre.
- OGRE3DBody or "Body" is half Actor, half SceneNode
- OGRE3DRenderSystem has Bodies
- Body has the magical bits that makes Ogre draw the Actor on the screen.
- NxOgre thinks Bodies are Actors.
- NxOgre can treats Bodies like as Actors.
- NxOgre's functions that use Actors, can use Bodies.


sorry

first i mean that, Actors is not visible but i still can see it by enable visual debug.
1. Question why i need to create Actors, not just create Body, furthermore, Body is visible and have physics. when do i need Actor?

2. Question why i can't attach Body to Actors, like Ogre attach Entity to SceneNode.

3. If there are three bodies and two of them hit each other, then what function can i use to detect a collision of Body is happened or not ?

4. If there is a bullet and some monsters, what is the way to retrieve a particular monster's pointer when that monster is hit by bullet?

5. Can i do volume selection? like Ogre's volume selection but more accurate than Ogre's

6. Like you say before, NxOgre has no concept of Ogre but why i can find SceneNode by calling getSceneNode() method? is that mean NxOgre can interact with Ogre's SceneManager?

7. If i want to create a game with physics can i use Ogre SceneManager with NxOgre?

8. How can i simulate physics in game? for example, a solider Body can walk down stair, go up stair and hit by bullet without trip, but only in explosion area, it will be pushed into sky and then fall on the ground.(the force depend on how strong the explosion is )

sorry a bit more questions

betajaen

21-09-2009 17:14:31

first i mean that, Actors is not visible but i still can see it by enable visual debug.
1. Question why i need to create Actors, not just create Body, furthermore, Body is visible and have physics. when do i need Actor?


Normally you don't, but you do need them when Bodies aren't suitable for the task in hand. Such as invisible walls, terrain, and so on.

2. Question why i can't attach Body to Actors, like Ogre attach Entity to SceneNode.

Because Bodies ARE Actors. You can't attach something to itself.

3. If there are three bodies and two of them hit each other, then what function can i use to detect a collision of Body is happened or not ?

Use a Collision Callback. There is a thread recently about it.

4. If there is a bullet and some monsters, what is the way to retrieve a particular monster's pointer when that monster is hit by bullet?

You wouldn't use bullets. You would use raycasting which is more accurate.

5. Can i do volume selection? like Ogre's volume selection but more accurate than Ogre's

Intersections or Volumes.

6. Like you say before, NxOgre has no concept of Ogre but why i can find SceneNode by calling getSceneNode() method? is that mean NxOgre can interact with Ogre's SceneManager?

Body stores a SceneNode for you. Every frame the Scenenode is moved by the Body when it moves, which Ogre picks up then draws it on the screen for you.


7. If i want to create a game with physics can i use Ogre SceneManager with NxOgre?

The OGRE3DRenderSystem already does that for you.

8. How can i simulate physics in game? for example, a solider Body can walk down stair, go up stair and hit by bullet without trip, but only in explosion area, it will be pushed into sky and then fall on the ground.(the force depend on how strong the explosion is )

That is a tricky subject at the moment. The Character Controller code is not working very well. You should come back to that later, once you've gotten to grips with the basics first.

spacegaier

21-09-2009 17:51:41

It seems (according to the link you posted) that you use an old version of NxOgre, called Bleeding. It is outdated and you should use the new version called BloodyMess (currently 1.5.5) You can get it from github (see this thread).

Then slowly step through the tutorials I wrote for BloodyMess. The link you posted above is covering the old version!

My tutorials can be found in the NxOgre portal.

Then most (if not all) of the questions above should be answered.

tomneo2000

22-09-2009 01:37:09

It seems (according to the link you posted) that you use an old version of NxOgre, called Bleeding. It is outdated and you should use the new version called BloodyMess (currently 1.5.5) You can get it from github (see this thread).

Then slowly step through the tutorials I wrote for BloodyMess. The link you posted above is covering the old version!

My tutorials can be found in the NxOgre portal.

Then most (if not all) of the questions above should be answered.



NO no, i use Git and also get it from github same link you give.
Your tutorial is so great i hope you can write more.

tomneo2000

22-09-2009 02:00:29



4. If there is a bullet and some monsters, what is the way to retrieve a particular monster's pointer when that monster is hit by bullet?

You wouldn't use bullets. You would use raycasting which is more accurate.


Yes use raycast is more accurate but what if i want to make bullet trace like this http://images.google.com.tw/imgres?imgurl=http://static-p4.fotolia.com/jpg/00/11/74/31/400_F_11743186_FkgxOLPuMiTqR1U1fSxZII1gqChJYvOe.jpg&imgrefurl=http://en.fotolia.com/id/11743186&usg=__DKubdxd-wrQGFblbhp60UtGZl8c=&h=224&w=400&sz=6&hl=zh-TW&start=5&um=1&tbnid=mW-yI14lwIe0_M:&tbnh=69&tbnw=124&prev=/images%3Fq%3Dbullet%2Btrace%26hl%3Dzh-TW%26sa%3DN%26um%3D1


5. Can i do volume selection? like Ogre's volume selection but more accurate than Ogre's

Intersections or Volumes.


volumes like this http://img194.imageshack.us/img194/2606/screenshot1zcw.jpg
Ogre's volume selection is not accurate it use object's bounding box to detect, and in that tutorial at the end of tutorial it say, In fact, the most common way to do "true" mouse selection is to first perform an Ogre query (such as a RaySceneQuery), then individually test each intersection returned from the query with a physics engine that will actually check the mesh's geometry to see if you actually hit it or just came very close.

tutorial is here http://www.ogre3d.org/wiki/index.php/Intermediate_Tutorial_4

Buy the way, if i create some Bodies and then i call mScene->getNbAcotrs() then it return 0, unless i create Actors, so i think Body is more like actual entity and Actor is like SceneNode

betajaen

22-09-2009 10:07:07

NxOgre Volumes or Intersections are far more accurate than the Ogre ones.


And no Bodies aren't like Entities, they are Actors. If anything Bodies and Actors a bit like Scenenodes and Shapes are a bit like Entities - using your analogy.

tomneo2000

22-09-2009 16:11:33

NxOgre Volumes or Intersections are far more accurate than the Ogre ones.


And no Bodies aren't like Entities, they are Actors. If anything Bodies and Actors a bit like Scenenodes and Shapes are a bit like Entities - using your analogy.


thanks for reply

i am not sure how to implement this. if i have a tank and a ball in the scene then when the tank touch the ball i wan to delete tank from the scene, both objects can move any time but only delete tank when tank touch ball or ball touch tank, how can i do this? i know there is a volume callback can do the collision but it seems not really useful for the objects i mention, do i really have to bypass NxOgre to use phyX , is so how to do?

betajaen

22-09-2009 17:32:37

Use a Collision Callback between the ball and tank. Once collided, make a note of the tank has been hit and in the next frame delete the tank.

tomneo2000

23-09-2009 04:59:36

Use a Collision Callback between the ball and tank. Once collided, make a note of the tank has been hit and in the next frame delete the tank.

i use Git
i searched forum for a long time and look in NxOgre code for how to use callback, but not lucky, i only see NxOgre::callback and i don't no how to use it, but in many post they can use GroupContactpair and write they own collision class by inherit something(don't remember), aslo can do collision between group and group and Bodies in same group never collide eacher, why? two version? but how about Git? where can i find tutorial about collision using Git?
for example i don't know what should i create or setup before i use callback.

tomneo2000

23-09-2009 14:31:56

anyone have done collision detection can tell me how to do it? Currently, i have two bodies tank and a big ball, i just what tank to be deleted when it touch the ball or touched by ball.

Do i need to access PhysX to use something like contact reporter?

i really stuck

betajaen

23-09-2009 14:57:37

Sigh.

class some_class : public NxOgre::Callback
{

void example()
{
mA = mRenderSystem->createBody(....);
mB = mRenderSystem->createBody(....);

mScene->setActorFlags(mA, mB, NxOgre::Enums::ContactPairFlags_All);
mA->setContactCallback(this);
}

void onContact(const NxOgre::ContactPair& pair)
{
std::cout << "OMG " << mA << " has hit " << mB << " !!!!" << std::endl;
}

NxOgre::Scene* mScene;
Ogre3RenderSystem* mRendersystem;
Body* mA, mB;

};


You set the ActorFlags up between A and B in Scene. Then you set a callback (inherit the class into one of your own), then assign it to A or B (or both). Then watch for collisions in the onContact function. You cannot delete or create Actors/Bodies in the onContact function - PhysX will crash.