[Bleeding] 1.0'22T5 (Unstable) for download. Testers needed.

betajaen

16-10-2008 12:58:43

WHAT? Betajaen your hot!

This is literally hot of the presses. This NxOgre 1.0'22 of course; I've worked with this code for under 24 hours, so I declare it unstable.

However; not to confuse the newbies I won't be placing it on the SVN straight away, until I am satisfied that it actually works with the masses - due to the changes of the core parts.

If you have been using NxOgre for less than two weeks, and even attempt to download this file - I WILL LAUGH AT YOU.

Release Notes

1.0 '22T5
+ Added destroyMesh method in ResourceSystem
<Betajaen: 09-October-2008>
+ Tidied up Machine class code, and moved mScene to protected
<Betajaen: 10-October-2008>
+ Callback system for Actors rewitten.
See http://www.nxogre.org/ActorContactCallbacks
<Betajaen: 11-October-2008>
+ ResourceStatus enum and getStatus added to Resource and FileResource classes.
<Betajaen: 12-October-2008>
+ Minor callback changes.
<Betajaen: 15-October-2008>



Download

http://get.nxogre.org/releases/NxOgre.1.0.22T5.zip (394kb)

All problems, compile errors and thumbs up in this thread only.
If I see any posts outside this thread - I WILL DELETE THEM.

Prophet

16-10-2008 14:32:24

The ActorContactCallbacks are surprisingly empty. Is this intended?

betajaen

16-10-2008 15:31:48

Yep, I haven't gotten around to writing the article yet, as I've been working on Flour for most of the day.

nargil

16-10-2008 18:58:16

And yet we have another T release. You crazy you Betajean ! xD thx alot

betajaen

16-10-2008 19:07:55

Oh, I'm insane, crazy and hawt.

This or T6 will probably be uploaded to the SVN within a week, with no objections.

Prophet

18-10-2008 13:34:58

I've been scratching my head a bit now, and it appears that whenever I add bodies with the new template system, it crashes when I delete the world-object. Perhaps I'm missing something? Here's my code anyway:for (int i = 0; i < 20; i ++)
nScene->createBody<NxOgre::Body>("Box01;Box01.mesh", new NxOgre::Cube(1), NxOgre::Pose(0, i*i, 0), "mass: 1");
Also, the leak-report reports a ton of leaks, but the log says nothing. This might be due to the fact that it crashes when it tries to delete, though.
It might have something to do with the way I'm controlling NxOgre, see this post.

Edit: It works fine in release.

betajaen

18-10-2008 14:00:22

Very very strange, I haven't encountered any problems with deleting World in release.

Have you tried using NxOgre "normally"?

Prophet

18-10-2008 14:14:43

I forgot to add, it crashes atpublic: BETAJAEN_SL_INLINE void _delete_range(Iterator begin, Iterator end)
{
for (; begin != end; ++begin) {
BETAJAEN_SL_DELETE(*begin); //<-Crash
}
}

I'm going to try the normal way now.

betajaen

18-10-2008 14:26:35

Well that looks like the pointer is invalid or most probably NULL.

Prophet

18-10-2008 14:47:28

Yes, question is why. I checked and they appear to be valid, except for description which is a bad pointer at both.
And normal way didn't work either, so I've probably forgotten something.

betajaen

18-10-2008 14:56:42

I tried this in Cake:

mWorld = new World("time-controller: ogre");
mScene = mWorld->createScene("Eddie", "renderer: ogre, controller: accumulator, gravity: yes, floor: yes");
for (int i = 0; i < 20; i ++)
mScene->createBody<NxOgre::Body>("Box01;cube.1m.mesh", new NxOgre::Cube(1), NxOgre::Pose(0, i*i, 0), "mass: 1");


Both in Debug/Release mode seem to exit fine. However I am getting leaks in Debug mode (quite a bit actually).

Prophet

18-10-2008 15:00:03

I did some further debugging and noticed that end changes value, but then there are two threads that ends ("Win32 thread") and then it stops changing. Thread issue?
OT: To manually simulate NxOgre you just has to set time-controller to none and manually simulate the world, right?

betajaen

18-10-2008 15:16:39

End?

PhysXDriver, but yep.

Prophet

18-10-2008 15:19:56

Yes, the iterator where it crashes. I don't have much clue what's going, it's your code. ;)

I suppose that's what NxOgre::World::Simulate does.

Prophet

18-10-2008 15:52:13

I tried cake and it crashes at the exact same in debug, but no crash in release.
Same thing here, a lot of memory leaks.

OT: moving down (with E) doesn't work in Cake. And a nice feature would be to be able to hold F11 down and it will continue to create boxes until you release it.

betajaen

18-10-2008 16:23:27

It's QZ for up/down.

Just go to line 1872 and change it to keyPressed and the one above to keyReleased.


But to be honest; Once/if we get this bug tracked down, this will probably be it for the "1.0" release. This new Bloody Mess code is getting off the ground now, and it's incredibly neat and well designed.

Caphalor

18-10-2008 16:59:52

This is more a general question:
I just upgraded to Nvidia PhysX System software 8.09.04 and PhysX SDK 2.81 and NxOgre now says "Unable to find the PhysX libraries. The PhysX drivers are not installed properly". Flour test says "nvcuda.dll not found. NVidia's "dark physx samples" are working and the most strange thing - an old excecutable from me which uses NxOgre 0.4 works, too. Help!

Edit: I have an Ati GPU.

Cronos

18-10-2008 21:07:54

This is more a general question:
I just upgraded to Nvidia PhysX System software 8.09.04 and PhysX SDK 2.81 and NxOgre now says "Unable to find the PhysX libraries. The PhysX drivers are not installed properly". Flour test says "nvcuda.dll not found. NVidia's "dark physx samples" are working and the most strange thing - an old excecutable from me which uses NxOgre 0.4 works, too. Help!

Edit: I have an Ati GPU.


Hi, I had a similar error: http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=8423
I hope this helps.

I'm running ok with 1.0'22 now.

Prophet

19-10-2008 09:57:48

Some more debug info:
It appears it crashes when SharedList destructor calls the delete_range-function.
The type SL uses is a NxOgre::Allocator::WatchedPointer. This is what VC++ says when it's called. _Flat->_delete_range 0x00801920 Betajaen::Flat<NxOgre::Allocator::WatchedPointer *,Betajaen::SharedAllocator>::_delete_range(NxOgre::Allocator::WatchedPointer * *, NxOgre::Allocator::WatchedPointer * *) void (NxOgre::Allocator::WatchedPointer * *, NxOgre::Allocator::WatchedPointer * *)Unfortunately I don't know much/anything about SL.
What differs this from the other calls I can't find out, it's a mishmash of evaluable and non-evaluable variables.
What might be of greater interest is that it won't crash if I only have one body. Manually giving them unique names and meshes doesn't change anything.
Hope that might be to some help. If there is anything I should try, just tell me.

betajaen

19-10-2008 10:45:39

I really don't think it's the SharedList code; I've been working with it exensitvly in BloodyMess for the last few days, and I haven't had any problems. I even have a memory tracker/allocation system written now, and it cleans up every last byte used.

I do think SharedList is cause a crash (but not the actual cause); due to a pointer being invalid or something being messed up with NxOgre.

Prophet

19-10-2008 11:31:11

Mhm, yes. It's really confusing, I redownloaded and recompiled NxOgre and now it crashes at void* Allocator::WatchedPointer::getPtr() {
return mPtr;
}
but if I add if(mPtr) it crashes at the old place.
But what really confuses me is that if I use floor I can only create one body without a crash. If I use floor I can create up to 12 bodies without a crash. I have absolutely no idea why. I'm stuck, so I've uploaded my cpp-file here. What might be of interest is the startPhysics-function at line 399 and step-function at line 455. (I apologize for my crappy code) I don't know what else to do. Sorry.

betajaen

19-10-2008 11:39:11

I'll have a look at it in a bit, and see if I can replicate the problem. Let's just hope I haven't initialized a pointer somewhere

Caphalor

19-10-2008 14:34:48


Hi, I had a similar error: http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=8423
I hope this helps.

I'm running ok with 1.0'22 now.


Thank you, it works now. Nevertheless it would be nice if betajen could try the new system software, because I don't think that it's limited to nvidia gpus - as I said applications which use physx 2.7 were still working for me!

Prophet

19-10-2008 21:03:39

I'll have a look at it in a bit, and see if I can replicate the problem. Let's just hope I haven't initialized a pointer somewhereThanks, much appreciated.

nargil

22-10-2008 00:02:08

I have a problem cooking a Convex.

float x,z;
NxVec3 vec;
manual_mesh = new NxOgre::Resources::ManualMesh(NxOgre::Resources::MT_Convex);
manual_mesh->begin();
for(int i=0; i<10; i++)
{
x=Ogre::Math::Sin((float)i/10.0f*Ogre::Math::PI*2.0);
z=Ogre::Math::Cos((float)i/10.0f*Ogre::Math::PI*2.0);

vec = NxVec3(x,0,z)*36.0f*skala;

manual_mesh->vertex(vec);
}
manual_mesh->vertex(0,1,0);
manual_mesh->vertex(0,-1,0);
m = manual_mesh->end();


It's working fine for a small scale (skala), but when it become larger than 3.6xxx the cooking crashes.

PhysX Error! NXE_INTERNAL_ERROR (f:\scmvista\experimental\PhysX_2.8.1_GPU\novode
x\SDKs\Cooking\src\ConvexMeshBuilder.cpp:53)
createHull: convex hull computation failed!
[NxOgre] Cooking of Convex mesh failed!


the debugger points at NxOgreMesh.cpp

void Mesh::acquire(MeshType type, void *data) {
... [CUT] ...
case MT_Convex:
{
mConvexMesh = static_cast<NxConvexMesh*>(data);
mNbReferences = mConvexMesh->getReferenceCount();
}
break;


From what I see data==0

Call Stack
> NxOgre_d.dll!NxOgre::Resources::Mesh::acquire(NxOgre::Resources::MeshType type=MT_Convex, void * data=0x00000000) Line 179 + 0xc bytes C++
NxOgre_d.dll!NxOgre::Resources::ManualMesh::end(NxOgre::Resources::Resource * r=0x0f28f988, bool cleanup=true) Line 316 C++
NxOgre_d.dll!NxOgre::Resources::ManualMesh::end(bool cleanup=true) Line 287 + 0x11 bytes C++
wxWed2.exe!cRotacje::utworz(float skala=4.0000000) Line 74 + 0xd bytes C++

betajaen

22-10-2008 00:09:36

Interesting, I've never seen the cooker fail a cook due to the positions of the vertices.

The only thing remotely in the SDK documentation is this:

NOTE: The hull generation may fail for input point sets which contain certain degenerate configurations. If you feel this to be an issue, please try not to provide input that contains two or more points close to each other, or in other ways would generate very thin triangles. NOTE: As of 2.5 the legacy cooker has been deprecated since its output is not compatible with the hardware collision code.

But it can't be that, can it?

nargil

22-10-2008 00:39:19

If that's the purpose wouldn't it crash also with a smaller scale ?

betajaen

22-10-2008 00:44:12

Yep, pretty much.

As far as I can tell your code is perfectly fine. I've even ran the math code through a calculator to see if it was a math error, but it's fine.

If you want, I can try it out myself. But it will take a few days - busy busy busy.

nargil

22-10-2008 00:53:33

I'd appreciate it. As for now i use a max_scale_limit, and leave this problem behind. Actually I don't need it that big, but it would be nice to know a solution, if the problem occurs for other objects.

irado

26-10-2008 13:06:39

I am use the 1.0'22T5, i try run the code to do somethings when actor collide, but when i add GroupCallback::InheritedCallback in my class


class AplicationListener : public FrameListener, public OIS::KeyListener,
public OIS::MouseListener, public OIS::JoyStickListener,
public GroupCallback::InheritedCallback


Show the error:


1>c:\iradosogrep3\include\AplicationListener.h(17) : error C2027: use of undefined type 'NxOgre::GroupCallback'
1> c:\ogresdk\nxogre\include\NxOgrePrerequisites.h(62) : see declaration of 'NxOgre::GroupCallback'
1>c:\iradosogrep3\include\AplicationListener.h(17) : error C2504: 'InheritedCallback' : base class undefined




What the problem? The collision the group actor change?

mcaden

26-10-2008 13:42:49

Yup, the new callback would be the problem there.

I believe there's example code in the T4 thread.

irado

26-10-2008 14:55:57

I find the post that you say, but if i understand correctly i must create one function for each actor that i want test the collision?

For example, create one method for robot, create other method for one cube?

How i know who touche who?

mcaden

26-10-2008 15:15:04

I believe having callbacks to groups are still an option.

Simply check the group of the object being collided with.

irado

26-10-2008 15:23:23

ok, i will try one things.

thanks

mcaden

26-10-2008 16:08:47

I haven't updated to the newest release yet because I've been busy implemented other systems. I'll be in the same boat redoing my callbacks when the next stable version is released.

betajaen

26-10-2008 16:33:11

Most likely I'll write an article about it but in the mean while have a look at NxOgreContactCallbacks.h, being more specific the javadoc comment part. Which I will paste here.

/** \brief ContactFunctions are used when a Contact is made, instead of inheritance or template
programming. A simple function pointer is used to reduce the amount of conditional
checking and function wrapping. It is up to you to implement the contact functions but
they must have the same function signature.
\example
An example of the three contact functions, you may even merge them together as one.
<code>
void onBeginContact(Actor*, Actor*, NxContactPair&);
void onEndContact(Actor*, Actor*, NxContactPair&);
void onContact(Actor*, Actor*, NxContactPair&);
</code>
How to bind them
<code>
myClass::myClass()
{
mContactFunctions[_onBeginContact] = _ActorContactCallbackFunction(&myClass::onBeginContact);
mContactFunctions[_onEndContact] = _ActorContactCallbackFunction(&myClass::onEndContact);
mContactFunctions[_onContact] = _ActorContactCallbackFunction(&myClass::onContact);
}
</code>
*/


It's fairly easy to do, the only "gotcha" is the pragma (at the top of the file) which you must use if you use MSVC.

You can use your callback with the functions in Scene called Scene::createActorContactPair or Scene::addCallback, again the comments for them briefly explain what they do.

irado

27-10-2008 12:26:32

I know that is this one sample question, more C/C++ than NxOgre but I add this code:


mContactFunctions[_onBeginContact] = _ActorContactCallbackFunction(&AplicationListener::onBeginContact);
mContactFunctions[_onEndContact] = _ActorContactCallbackFunction(&AplicationListener::onEndContact);
mContactFunctions[_onContact] = _ActorContactCallbackFunction(&AplicationListener::onContact);


And show the message error:


1>.\src\AplicationListener.cpp(94) : error C2065: 'mContactFunctions' : undeclared identifier
1>.\src\AplicationListener.cpp(94) : error C2065: '_onBeginContact' : undeclared identifier
1>.\src\AplicationListener.cpp(94) : error C3861: '_ActorContactCallbackFunction': identifier not found
1>.\src\AplicationListener.cpp(95) : error C2065: '_onEndContact' : undeclared identifier
1>.\src\AplicationListener.cpp(95) : error C3861: '_ActorContactCallbackFunction': identifier not found
1>.\src\AplicationListener.cpp(96) : error C2065: '_onContact' : undeclared identifier
1>.\src\AplicationListener.cpp(96) : error C3861: '_ActorContactCallbackFunction': identifier not found


So I try this:


ActorContactCallback::mContactFunctions[ActorContactCallback::_onBeginContact] = _ActorContactCallbackFunction(&AplicationListener::onBeginContact);


but the error change for:


1>.\src\AplicationListener.cpp(94) : error C2677: binary '[' : no global operator found which takes type 'NxOgre::ActorContactCallback::CallbackType' (or there is no acceptable conversion)
1>.\src\AplicationListener.cpp(94) : error C3861: '_ActorContactCallbackFunction': identifier not found
1>.\src\AplicationListener.cpp(95) : error C2065: 'mContactFunctions' : undeclared identifier


What the problem?

betajaen

27-10-2008 14:23:43

You have to INHERIT from that class as well, how else do you think you gain the mContactFunctions variable?

irado

28-10-2008 11:21:01

I read in comment:


ContactFunctions are used when a Contact is made, instead of inheritance or template programming.


So i think that dont need use Inheritance, but my english is very simple into i understand error. :D

My class are using inheritance this form:


class AplicationListener : public FrameListener, public OIS::KeyListener, public OIS::MouseListener,
public OIS::JoyStickListener, public ActorContactCallback


in the code is:


mContactFunctions[_onBeginContact] = _ActorContactCallbackFunction(&AplicationListener::onBeginContact);
mContactFunctions[_onEndContact] = _ActorContactCallbackFunction(&AplicationListener::onEndContact);
mContactFunctions[_onContact] = _ActorContactCallbackFunction(&AplicationListener::onContact);


but show the error:


1>.\src\AplicationListener.cpp(94) : error C3861: '_ActorContactCallbackFunction': identifier not found
1>.\src\AplicationListener.cpp(95) : error C3861: '_ActorContactCallbackFunction': identifier not found
1>.\src\AplicationListener.cpp(96) : error C3861: '_ActorContactCallbackFunction': identifier not found


If the problem is inheritance, what class i must use?

thanks

betajaen

28-10-2008 12:09:17

You inherit from ActorContactCallback, implement those functions as names you want them to be. Then bind them in the constructor of your class.

irado

28-10-2008 13:18:22

Yes, thanks betajean for you help and your attention, the project run.

But i dont understand one thing, i have one robot and one cube how actors, how i can set that robot change your scale when the robot and cube collide?

what method i define that functions:


void onBeginContact(Actor*, Actor*, NxContactPair&);
void onEndContact(Actor*, Actor*, NxContactPair&);
void onContact(Actor*, Actor*, NxContactPair&);


Listen the collisions the robot.

helloween

01-11-2008 17:32:37

I have only one problem for the moment with this release.
the wheels dont get visually updated.
I have tried the WheelSet, or to manually add these wheels, they do appears attached in the debug renderer, but the ogre node does not follow the physic wheel.
Also I have tried to create these wheels with and without the Scene and its the same ( I was thinking first maybe only wheels created via Scene get updated).

helloween

02-11-2008 03:56:02

I have only one problem for the moment with this release.
the wheels dont get visually updated.
I have tried the WheelSet, or to manually add these wheels, they do appears attached in the debug renderer, but the ogre node does not follow the physic wheel.
Also I have tried to create these wheels with and without the Scene and its the same ( I was thinking first maybe only wheels created via Scene get updated).


Ok I found the problem, I though that providing "mode: absolute" into the params for the creation of the wheels was taken into account but it is not.
I had to add manually :

exWheel->mWheel->setRenderMode(RenderableSource::RM_Absolute);

Which I did not have to do in 1.021 :?

Fred

02-11-2008 13:34:33

Hi there,
In my test-application I get an error, if I try to create a NxOgre::World.

My Code: world_ = new NxOgre::World("time-controller: ogre");

In this line of NxOgreWorld.cpp the application crashes:
#if (NX_USE_DEBUG_RENDERER_API == 1)
NxDelete(mDebugRenderer);


What's wrong?

nargil

02-11-2008 13:54:30

did you copy the nxogre.dll to your projects bin dir ?

Fred

02-11-2008 14:04:05

yes I did


it seems like NxOgre trys to delete the Debug-Renderer, which does not exist. Do I have to turn NX_USE_DEBUG_RENDERER_API off, in any way?

nargil

02-11-2008 14:13:29

There is no need to modify anything in nxogre - it works perfectly fine. For me it looks like you were linking/using different versions of nxOgre .dll / .lib / headers. Double check it.

Fred

02-11-2008 14:29:59

But I don't use differen versions of NxOgre. I've just checked it.
I deleted all the old files. I've checked the directories and all has to be work fine. But it doesn't...
I've also recompiled NxOgre, but nothing...

Fred

02-11-2008 20:17:34

Which version of PhysX SDK shall I use? Maybe this is my fault. I use v2.8.1.

nargil

02-11-2008 20:32:59

It wouldn't compile with an older PhysX SDK.

Fred

02-11-2008 20:35:11

Because I've just tried the same code, with an older NxOgre version, but also compiled with v2.8.1 and I got the same error. After compiling NxOgre with 2.7.3 the code runs without any problems.

Fred

03-11-2008 11:07:15

Ok thanks.
I have built NxOgre with PhysX SDK 2.8.0 and now it seems to work.

almondega

03-11-2008 13:06:31

hi, i updated to T5 right now
and i'm having problems in the new collision detection

from the betajaen sample:

class Harry : public ActorContactCallback
{
public:
void SomeoneTouchedHarry(Actor*,Actor*, NxContactStream&);
};

Harry::Harry()
{
mContactFunctions[_onBeginContact] = _ActorContactCallbackFunction(&Harry::SomeoneTouchedHarry);
};


first, NxContactStream should be ContactStream

but, theres no one _ActorContactCallbackFunction in any .h file
where did came from ?
how to use this new collision detection method..

tks :wink:

nargil

04-11-2008 11:32:50

just lucky guess but have you tried to remove the underline _ ?


typedef void (NxOgre::ActorContactCallback::*ActorContactCallbackFunction)(NxOgre::Actor*, NxOgre::Actor*, NxContactPair&);

almondega

04-11-2008 22:16:43

nargil u r right
at least the code compile now =]
tks

Fred

22-11-2008 11:02:22

If I use this line in my code:
body_ = game_env_.scene->createBody<NxOgre::Body>(vis_id, new NxOgre::Cube(Ogre::Vector3(1,1,1)), NxOgre::Pose(rotation_, position_), params);

I will get an error like:
cannot convert from 'NxOgre::Actor *' to 'NxOgre::Body *'

OK! I can solve this error with a static cast:
body_ = static_cast<NxOgre::Body*>(game_env_.scene->createBody<NxOgre::Body>(vis_id, new NxOgre::Cube(Ogre::Vector3(1,1,1)), NxOgre::Pose(rotation_, position_), params));

But is this the way which I am supposed to go?
Or is my first line supposed to work?

Thanks for help
Fred

Prophet

22-11-2008 11:18:18

No, createBody returns an Actor.

Fred

22-11-2008 11:50:55

I know, but I wounder at this.
There is allready a function which creates an Actor. So why this function which is called createBody returns an Actor?

betajaen

22-11-2008 12:29:50

Because it's being put into an array, and has to be an Actor. If its casted then I'm sure I'll need the header for what it's being casted from in the Scene header.

Besides, a little static_casting in your application couldn't hurt?

Fred

22-11-2008 12:34:31

Okay that sounds logical. Thanks for your answer.

almondega

27-11-2008 21:21:19

troubles in the Contact Event

the Colision Groups:

ActorGroup *buildColision = scene->createActorGroup("BuildColision");
ActorGroup *actorColision = scene->createActorGroup("ActorColision");


the Actor Params:

ActorParams actorParams;
actorParams.setToDefault();
actorParams.mContactFlags.mStartTouch = true;
actorParams.mContactFlags.All();


the Camera Body (witch will generate the callbacks)

mActor = scene->createBody<Body>("MainCamera",new NxOgre::Sphere(2),Vector3(-80,0,75),renderableParams,actorParams);
mActor->setGroup(actorColision->getName());


the Ground, witch will receive the Camera collision

Actor *ground = scene->createActor("Ground",new Ground(0.35),Vector3(0,0,0),"static: yes");
ground->setGroup(buildColision->getName());


and the Contact callback, from the main class

ActorContactCallback::mContactFunctions[ActorContactCallback::_onBeginContact] = ActorContactCallbackFunction(&Kyria::onBeginTouch);

and finally, the contact function

void Kyria::onBeginTouch(Actor* aaa,Actor* bbb, ContactStream &ccc) {
printf("CONTACT");
}


the problem is:
theres no contact response
in the last version before this new system of contact, i had to set the group domination, like ActorColision will call callbacks when contact with BuildColision
but i dont know how to set this in this new version
should i do it to enable callbacks?

tks
;)

almondega

18-12-2008 00:01:18

After a lot of seach in the nxogre .h files, i figured out how to make contact callback works.

This is one way, applying a callback for two actors directly

The game class, witch gets the ActorContactCallback class
class GameFPS : public NxOgre::ActorContactCallback
{
public:
....
void onBeginTouch(NxOgre::Actor*,NxOgre::Actor*, NxContactPair&);
void onEndTouch(NxOgre::Actor*,NxOgre::Actor*, NxContactPair&);
void onTouch(NxOgre::Actor*,NxOgre::Actor*, NxContactPair&);
.....
};


The callback configuration for start and end touchs
void GameFPS::enter()
{
.....
scene = mWorld->createScene("FPS_World","renderer: ogre, gravity: yes, controller: accumulator");
scene->addContactCallback(this,GC_Delete); //look the "this", thats because i'm using my own class callbacks

mActor = scene->createBody<Body>(.....);
ground = scene->createActor(.....);

scene->createActorContactPair(mActor,ground,NX_NOTIFY_ON_START_TOUCH|NX_NOTIFY_ON_END_TOUCH);

mContactFunctions[ActorContactCallback::_onBeginContact] = ActorContactCallbackFunction(&GameFPS::onBeginTouch);
mContactFunctions[ActorContactCallback::_onEndContact] = ActorContactCallbackFunction(&GameFPS::onEndTouch);
mContactFunctions[ActorContactCallback::_onContact] = ActorContactCallbackFunction(&GameFPS::onTouch);
//look the mContactFunctions array, this comes from the ActorContactCallback friend of my class
......
}


and the callback signatures implementation (only the begin sample)
void GameFPS::onBeginTouch(NxOgre::Actor* a,NxOgre::Actor* b, NxContactPair &c)
{
printf("Contact: %i touched %i\n",c.actors[0]->getGroup(),c.actors[1]->getGroup());
}


:shock:

debug

20-12-2008 19:05:19

Hi;

i am using 2T5 with Ogre 1.4.9 and Physx 2.8.0 , thus i have a problem with ClothParams class. When i try to define

NxOgre::ClothParams cg;
cg. //i can't reach anything here


compiler gives me an error about undefined class ClothParams...

I am uncluding "NxOgre.h" and giving the compiler home directory of NxOgre.. What is wrong? can anyone help.

Note: Not only with ClothPArams also FluidParams for example , same issue. But i can reach ActorParams or NodeRenderableParams..

i guess cloth is not supported in NxOgre 2T5 !! i couldn't find anything about this and this took my time :(

i tried with NxOgre 1.0 SVN release again no luck, i am missing something somewhere..

lonwolf

20-12-2008 20:48:24

i don't think their written. only defined. anyway i have 1.5 so i'm waiting for them xD

debug

20-12-2008 21:38:09

ok hard to find but the cloth and character systems are ignored after 0.9,
i will find another way to play with cloths then..

lonwolf

20-12-2008 21:43:13

you can make your own character controller or use betajen's Kinematic controller class. As for cloths.. play with openGL :) for now

almondega

23-12-2008 21:08:27

Some questions about the scene controler

i was using "accumulator" because of the 1.0'21 version, and had very smooth movements

now, in the 1.0'22T5, "accumulator" doenst seen so smooth, then i changed to "variable" and is perfectly smooth now, no mather the frame rate

is this correct? variable is smoother than accumulator?

Fred

26-12-2008 13:44:47

I want to make my own ActorContactCallback. It's not difficult, but I've to use the line:
ame_env_.scene->createActorContactPair( get_object_by_id("player")->get_body(), NxOgre::Scene::AT_AllActors, true, NX_NOTIFY_ON_START_TOUCH|NX_NOTIFY_ON_END_TOUCH|NX_NOTIFY_ON_TOUCH, this);
Is it possible to create a ActorContactCallback which gets all contacts of all actors in the scene, without adding all actors with createActorContactPair?

almondega

26-12-2008 20:33:23

yes there is
look at the .h file witch has the createActorContactPair method
near this method has one to create a contact pair for all actors in the scene (look the comments)
of course you will lose performance when u call it, but will avoid adding pair for each contact

Fred

27-12-2008 16:11:18

Yeah maybe I will lose some performance, but probably i will not lose as much as I would lose, if I created a own ContactCallback for every single object.

lonwolf

27-12-2008 16:59:58

if that's what you have in mind, indeed, one for all. what are you trying to do when any 2 objects collide? if may i ask :) sounds very performance destroyer-type. just out of curiosity

Fred

27-12-2008 19:00:40

Every object has a function which is called on contact. So these function would be called in callback-contack functions. But now I have a Problem, that after deleting and new creating of every object and of the whole contact-callback, my application crashes at this line: b_actor = (static_cast<VoidPointer*>(pair.actors[1]->userData))->toActor();
or at this: (ptr->mCallback->*(ptr->mCallback->mContactFunctions[contactID]))(a_actor, b_actor, pair);
And it doesn't matter, wether I create one contact callback or wether I create a contact callback for every object. The applications crashes. It seems the contact-callback works before recreating the objects. Have I to remove the contact callback by hand or have I to delete the contact-pair, I added?

almondega

27-12-2008 19:11:14

could be this problem:
you define the collision callback param to detect: start / keep / stop touching
but you only register a start callback
then, the NxOgre will call the keep and stop callbacks, and are null, and then, crash
make sure you are defining callbacks for what the collision needs, there are a param do define the type of contact: start, keep, stop
if you select only start, then you only need to register the start callback

Fred

27-12-2008 20:03:06

My code looks like this:
game_env_.scene->addContactCallback(this, NxOgre::GC_Delete);
game_env_.scene->createActorContactPair( get_object_by_id("player")->get_body(), get_object_by_id("start")->get_body(), NX_NOTIFY_ON_TOUCH);

mContactFunctions[_onContact] = NxOgre::ActorContactCallbackFunction(&level::on_collision);


This function does exist for sure and it works for the first time. But then(i leave the game, go back to main menu and then back again to game) there somtimes crashes the application. Not all the time. Sometimes after the second, sometimes after the 10th reload of the game. If I don't create any contact pairs, the application runs very well. So I think, that the contact pair isn't completly removed and so the application trys to get an object which doesn't exist. What have I to do to release the all the actor callback functions for sure?

EDIT: The error occurs just, if the two objects are in contact. But it occurs also if the two object are in contact after a while.

lonwolf

27-12-2008 20:43:28

can you post more code? it makes me feel theres something wrong with the creation / deletion of those callbacks (nothing else seems to be the problem).

like that collision function and the start / back to main menu procedures
edit: try also removing the callbacks manualy (i never done this before myself though)

Fred

27-12-2008 21:00:16

I'm just trying to create a own scene for the game game-state. But at the moment I have some trouble with deleting the scene.

EDIT: Okay now all seems to work! But what is the better way? One Callback for every single object which calls a function of the object to handle collision or one callback for every single object?
Thanks for help!

lonwolf

27-12-2008 21:59:22

the problem was when you came back to the main menu part , doing something along the way screwed the callbacks which were registered using some actors. more scenes acording to the game-state is the way to go :wink:

to answer your question, both aproaches as resource instensive, but if you really need it:
1. use one major callback if you have at least 1 function that needs to be called when ANY collision will occur.
2. use manual pair callbacks if you need to test more things but depending on the objects. eg you want to add sound when something is moving along a floor/wall/ceiling/whatever, but this test is useles if your object colides with something in air or on some surfaces other than those that require that sound. Doing all these tests in 1 huge callback may kill the performance, especially if you have a case (or even more) when 2 objects will collide and the program(game) won't do anything regarding this matter.

i'd go for pairs if i were you ,because from my point of view ,in our game, a contact callback between a house and the terrain (both static and probably colliding in some points - always) is useless and inefficient due to the fact that some objects will be always colliding.

[edit]
thinking and coding it simple may prevent unwanted bugs which will consume a lot of time :)

Fred

27-12-2008 22:38:02

Thank you a lot for your advices. I think, I will go for pairs! It seems to be the best solution.

Fred

29-12-2008 14:45:17

However NxOgre seems to have a problem with different Callbacks from the same class-type. I have one class game_object. All objects like ground and ube inherit from this class. If I create a Contactcallbak for e.g. obj_cube and one for obj_ground, the application will crash on collision with obj_cube.
So I probably have to use one for all.

nargil

08-02-2009 14:14:29

Found a bug in mScene->CreateBody, when using NodeRenderableParams

It returns NULL even though everything is created well.




char* nazwa = new char[20];
sprintf(nazwa, "LightNode%d", 0);
for(int i=1; mSceneMgr->hasSceneNode(nazwa); i++) sprintf(nazwa, "LightNode%d", i);
Ogre::SceneNode* snL = aktywneSN->createChildSceneNode(nazwa);
Ogre::Light* light = mSceneMgr->createLight(nazwa);
snL->attachObject(light);
snL->attachObject(mSceneMgr->createEntity("zarowka.mesh", Ogre::SceneManager::PT_CUBE));

NodeRenderableParams np;
np.setToDefault();
np.mIdentifierUsage = NodeRenderableParams::IU_Use;
np.mIdentifier = snL->getName();
cSwiatlo* swiatlo = (cSwiatlo*)mScene->createBody<cSwiatlo>("dupadsadasdsadsaa",new NxOgre::Cube(0.4,0.8,0.4), pose, np, ActorParams());

// without the next line swiatlo==0
swiatlo = (cSwiatlo*)mScene->getActor("dupadsadasdsadsaa");
// now swiatlo is a correct pointer.

DGL

11-02-2009 10:32:24

Hi All,

I try to run a basic application with NxOgre 1.0'22T5 and following error appears:

[attachment=0]Assertion Failed.JPG[/attachment]

I'm using VC++ 2008 + Ogre SDK v1.6.1 + NxOgre 1.0.22T5 + PhysX v2.8.1

If I compile same source code but it's using NxOgre 1.5.2 then It work fine.

Any Idea?

Thanks in advance for your help.

betajaen

11-02-2009 12:31:18

It's an Ogre problem. Have you created Ogre's Root, init the plugins, etc. before using NxOgre?

DGL

11-02-2009 12:55:29

Thanks betajaen for your answer

I'm using OGRE "ExampleApplication" Class.

I understand that I need to setup OGRE manually to use NxOgre. Is it right?

Thanks

DGL

11-02-2009 13:10:16

Thanks betajaen for your answer

I'm using OGRE "ExampleApplication" Class.

I understand that I need to setup OGRE manually to use NxOgre. Is it right?

Thanks


Problem SOLVED

Thanks

codex

19-02-2009 08:28:43

I don't know, well. but, is it wrong code ?

WheelSet* WheelSet::createFourWheelSet(NxReal radius,float3 forward_left,float3 backward_right,Actor* actor,
WheelParams wp,NodeRenderableParams lnrp,NodeRenderableParams rnrp)
{
WheelSet* set = NxNew(WheelSet)();
ExtendedWheel* w0 = set->createWheel(FrontLeft, radius, forward_left, actor, wp, lnrp);
forward_left.i = backward_right.i;
ExtendedWheel* w1 = set->createWheel(FrontRight, radius, forward_left, actor, wp, rnrp);
ExtendedWheel* w3 = set->createWheel(RearRight, radius, backward_right, actor, wp, rnrp);
backward_right.i = -backward_right.i; // modified <---------- original code ; forward_left.i;
ExtendedWheel* w2 = set->createWheel(RearLeft, radius, backward_right, actor, wp, lnrp);
set->registerMachine(actor->getScene());
return set;
}

zstars

05-03-2009 16:37:59

Did anyone manage to solve Prophet's problem? I seem to be having a similar one.


void* Allocator::WatchedPointer::getPtr() {
return mPtr;
}


It's crashing at the return, when doing a delete mWorld in Debug mode.


There seems to be some bugs on the Scene::addContactCallback function too (or in the DestroyScene one). When creating a contact callback using GC_Never_Delete, if later you destroy the scene, the program crashes.


Additionally,there is a bug in the isYes function that parses SceneParams when creating a new scene. It always returns true. Fortunately, this one I can solve, by just replacing the return with:

return (y == "y" || y == "Y" || y == "t" || y == "T" || y == "1");

Kroz00

20-03-2009 05:54:10

What versions of Ogre does this support?

1.4 or 1.6?

nargil

20-03-2009 07:21:41

both

zstars

25-03-2009 07:57:14

Is addContactCallback supposed to add a callback which gets automagically called whenever any collision occurs? If so, how do you use it? mNxScene->addContactCallback(this, NxOgre::GC_Never_Delete); doesn't seem to be doing anything for me.