[SOLVED] Using buoyancy with Mogre and MogreNewt

hiramajo

01-12-2008 07:05:49

Hello.
Can anybody please help me with how to use buoyancy with MogreNewt.
Have figured out how to use the ForceCallbackHandler, but are struggling with the BuoyancyPlaneCallbackHandler.
Small example would be nice :)

hiramajo

02-12-2008 19:28:21

Nobody?

I can not figure out how to use the BoyancyPlaneCallbackHandler.

Bekas

04-12-2008 19:29:02

You can get some hints from the OgreNewt sample here: http://ogreaddons.svn.sourceforge.net/viewvc/ogreaddons/trunk/ogrenewt/demos/Demo06_SimpleBuoyancy/OgreNewtonApplication.cpp?view=markup

Post if you have problems converting some C++ code to C#.

hiramajo

05-12-2008 04:34:44

Thanx for the reply.

Problem solved, just had to read a bit on how to use delegates.

Beauty

12-12-2008 11:01:51

If somebody ported example code to Mogre, please publish it. Best would be to add the code to wiki.

Chulein

14-01-2009 09:43:12

If somebody ported example code to Mogre, please publish it. Best would be to add the code to wiki.

I sure need it know. did it ever get up on the wiki?

Im having the same problem and was wondering if someone could be so kind and share some knowledge on how to solve this BuoyancyPlaneCallbackHandler.

thanks in advance.

Beauty

14-01-2009 23:43:19

Did you look to the C++ example code?
This is the first way.
In Mogre the code could be similar.


Here is a help page of Newton API.
There you can search for buoyancy. Then you find e.g. NewtonBodyAddBuoyancyForce
The function names are different to Ogre/Mogre, but there are useful informations about several functions.
http://www.runehunter.phpnet.us/NewtonHelp.html

For buoyancy I found no callback in the API.
Maybe you have to use a ContactCallback and check the properties of the colliding bodies.
Informations about using ContactCallbacks I added here:
http://www.ogre3d.org/wiki/index.php/Co ... ith_Newton


update:
I misunderstood and didn't see that the problem is solved.
My unnecessary text is grey now.

Beauty

15-01-2009 01:53:52

Problem solved, just had to read a bit on how to use delegates.
Can you post the code please?
It would be helpful for others.

Chulein

15-01-2009 10:49:42

ive sendt a pm to hiramajo asking for some assistance on the subject.

Chulein

21-01-2009 12:20:09

no response yet from hiramajo.
Anyone else who can help me with this problem?


Chulein

smiley80

21-01-2009 13:28:53

Not sure if that is correct.

You have to create a method for the delegate like that:

bool MyBuoyancyPlaneCallbackHandler(int collistionID, Body body, Quaternion orientation, Vector3 position, ref Plane retPlane)
{
// insert code here
}


And then add bouyancy:

MyBody.AddBouyancyForce(1, 2, 3, new Vector3(0,0,1), this.MyBuoyancyPlaneCallbackHandler);

Chulein

21-01-2009 13:39:52

great!.. I will give it a go when i get home.
Thanks :)

Beauty

21-01-2009 16:43:38

And now the snippet of simley80 is linked from the MogreNewt page of wiki :wink: