3ds Max scripts to set Physic and export to OgreNewt

Drakon

06-04-2007 15:31:12

I'm making some scripts for my friend who want to make a simple game in Ogre with OgreNewt ;). And he decided to use a 3ds max as a main tool for creating levels. So why don't setup physic in 3ds and export it to maybe .xml file , and then parse it in app.

So for now you can add a physic body to object, add some joints and make MaterialPairs.

Bodies :

- box
- sphere
- capsule
- cone
- cylinder
- convex

- each body can be Static or Dynamic
- ConvexHull is dynamic - convex type
- TreeCollision is static - convex type
- of course you can set your mass and material name



Joints :

- UpVector
- BallAndSocket

- BallAndSocket with limits or not



MaterialsPair :

- well... all properties of materialspair
- softness, elsticity ... etc...



This is what I have now. Maybe tomorrow i will end this so i will upload source of scripts and library to load them in OgreNewt ;)

If you are not bored to death right now, here is small test video http://www.youtube.com/watch?v=pwelaY8zBsk - it should be working now. But the quality is crappy ... so here is better one but you must download it http://www.4shared.com/file/21449408/af63050e/end.html .

I'm thinking that this scripts can be useful for beginners (like me :D, and my friend ) for creating levels with OgreNewt.

Current version - 0.21 - http://www.4shared.com/file/18060996/168f1cdf/OgreNewt_Max.html

All coments are welcome :):)

Drakon

07-04-2007 00:21:19

Here it is: http://www.4shared.com/file/18060996/168f1cdf/OgreNewt_Max.html

Demo, scripts ,source :)

to create my world and set physic in demo:

// oFusion World
OSMScene oScene = OSMScene(mSceneMgr,mRoot->getAutoCreatedWindow());
OSMSceneCallbacks oe_Callback;
oScene.initialise("test.osm",&oe_Callback);
oScene.createScene();

// OgreNewt Loader
loader = new Loader("NewtOgre.xml",mSceneMgr,m_World);
loader->LoadMaterials();
loader->LoadBodies();
loader->LoadJoints();
loader->LoadMaterialPairs();


To move in demo just press and hold right button on mouse and press arrow to move.
Left mouse button is for moving objects.

I compiled demo in VS 8.0 SP1 so I added vcredist if someone don't have them.

ok. now I can go sleep.

celic

08-04-2007 01:24:22

Thanks a lot!
Could be very usefull, I'll take a look :-)

billwillman

09-04-2007 02:59:42

Very cool project.
But I only can see BallandSocket Joint in Joint Plane.
I expect your other Joint in 3d Max

Drakon

09-04-2007 18:02:48

Thanks for warm words :) I was far away from my pc at the weekend but now I'm back and starting to coding :)

Drakon

10-04-2007 13:44:18

Elo :) I added more joints (Slider,Hinge,Universal,Pulley,2D,Gear).

Here is new source - http://www.4shared.com/file/18060996/168f1cdf/OgreNewt_Max.html

Vectrex

11-04-2007 04:22:40

really cool. Not only that but I just learned how to maxscript from your code :)
The only things I can suggest is to add compound objects (to joints?) because they're very handy.
Proxy collision shape support would be cool for simplified convex collision.
One other thing might be to have a tick box to 'selection auto update' to show the values of a selected object... but I know this would require reverse parsing ;) Plus I like the existing option of setting some values and applying to all selected easily.
Great work!

billwillman

11-04-2007 11:24:37

You are very high efficiency.
If you can add preview Physics in 3d max,it is perfect! :lol:

billwillman

11-04-2007 12:14:20

I use your Newton Joint Tool in 3d max.
It can't set Select Body1 to NULL??
But In the Physics,Sometimes it is need.


How to set Hinge,I see your MOVIE, You use Dummy. But I set my Physics XML File:


<World>
<Element name = "Box01" object = "Static" type = "Box" size = "121.408 -3.04909 106.268" position = "-10.3254 5.5137 15.5826" rotate = "-1.0 0.0 0.0 0.0" mass = "0.0" material = "Box3" > </Element>
<Element name = "Box02" object = "Dynamic" type = "Box" size = "6.76328 37.6812 69.5652" position = "-27.029 46.8599 28.0193" rotate = "-0.5 -0.5 0.5 -0.5" mass = "5.0" material = "Box1" > </Element>
<Element name = "Box03" object = "Dynamic" type = "Box" size = "6.76328 37.6812 69.5652" position = "11.0506 46.8599 28.0193" rotate = "-0.5 -0.5 0.5 -0.5" mass = "5.0" material = "Box2" > </Element>
<Joint type = "Hinge" body1 = "Box02" body2 = "Box03" position = "-24.8395 50.5564 -26.1111" pinx = "0" piny = "1" pinz = "0" > </Joint>
<Material name = "Box3" > </Material>
<Material name = "Box1" > </Material>
<Material name = "Box2" > </Material>
</World>


Thanks

Drakon

11-04-2007 16:55:09


The only things I can suggest is to add compound objects (to joints?)

emmm... what do you mean by that ?


Proxy collision shape support would be cool for simplified convex collision.

Can you describe some more, because my english and Newton knowledge isn't as that big.


might be to have a tick box to 'selection auto update' to show the values of a selected object

It will be there ;) Just give me some time.


If you can add preview Physics in 3d max,it is perfect!

I'm wondering how it is done for reactor in 3ds. I will search for some information, how it can be done ;)


It can't set Select Body1 to NULL??
But In the Physics,Sometimes it is need.


Now you can ;) New version : http://www.4shared.com/file/18060996/168f1cdf/OgreNewt_Max.html


How to set Hinge...


You need 2 bodies(or just one), 2 hinge joints... Just watch this video http://www.4shared.com/file/18061256/ed3db57/hinge_end.html
Maybe I'm not good teacher but it should help you.

nacsasoft

16-06-2007 21:11:15

Hi Drakon !

I want to download the MaxScript and the link is not good.
Please check and correction the link !
Thank You !!!!! :lol: :lol:

Drakon

17-06-2007 10:42:04

Sorry... :oops: I totally forgot to login on 4shared...
Here is the link to scripts and loader : http://www.4shared.com/file/18060996/168f1cdf/OgreNewt_Max.html

nacsasoft

18-06-2007 10:25:27

Thank You the correct link !!!!
:D :D

s0lidnuts

05-07-2007 00:13:11

You could make this a general xml parser =)
I'm going to use this and it will be very helpful ;D but I think someone could make it general purposes with a field in wich the user could define another vars, and then set callbacks for them on the game code =)

raven_coda

19-07-2007 04:52:27

I've compiled the soucre but I'm missing test.osm

Also How do I use in 3dsMAX? the high quality video link is broken, along with many other links. Can you please update?

Drakon

19-07-2007 12:33:54

Hi

test.osm was just an example of exported osm scene feom the 3dmax. you can use whatever scene you like.
Here is quick compiled demo with media : http://www.4shared.com/file/20204052/420c263d/demo.html . It is simple city - some boxes.

I don't have a time to write instruction (last one was lost by accident..) right now... maybe later ;) Please watch this video (download, don't watch in mini size) --> http://www.4shared.com/file/18061256/ed3db57/hinge_end.html ,maybe this will hep you a little.

nacsasoft

11-12-2007 16:41:04

Hi !!

These scripts may not be to translate under Blender ?
Help would be very big for them who Blendert it is used !!!! :D :D