Newton + Wings3D as editor

Share with us how are you using the powerrrr of the force

Moderator: Alain

Newton + Wings3D as editor

Postby registration information » Sat May 21, 2005 9:51 am

Hello :-)


I wanted to tell you what i'm working on, because i quite happy that it does work correctly ^_^




Few years ago, i built a script-engine that works with plugins to extend its capacities. I used this script-engine as the core of a 3D engine.

I even tryed to build a physics plugin, but since i was too bad with math and physics, i abandonned this idea and searched for an easy, afordable and stable physiscs engine.

I found Newton and i created a plugin for Newton :-)


All of that works perfectly :-)
Though, building large scenes with lots of joints and physics things, was a bit boring and tiedous since i had to make everything by hand into my scripts ... (about 10 to 30 lines of codes for each objects)

As modeler, i use Wings3D that is a great software too, and which is open source but wrote in a weird nightmarish language --> Erlang.


Last week, i decided to start to learn Erlang so i can modify a Wings3D exporter to add some litlle functionnalities to make my life easier when exporting scenes ... but i wen't so far that now, i can use Wings3D to generate scripts for my engine :-)


I can use Wings3D to position and orients joints into my scene.


I successfully added "helpers" to position and orients joints. And the script is generated correctly :-)

For the moment, it support only the 6 basical joints :

Image
UpVector, Ball and Socket, Slider, Hinge, Corkscrew and Universal Joint.


I use those objects as helpers into my scene to define position and orientation of joints into the scene so the exporter can generate the corresponding script for my engine.

Image


To define parameters of objects and joints (so the exporter can now if it is a static or dynamic object, and what is the parent and children of a joint) i simply add those parameters after the object name like that :
Image

Here, p000 to p003 are the rectangular boxes.

The * means that those boxes use a default material for the physics. Instead of the * i can put a material name if i want.

obj means that it must be put into the "obj" list of objects (that correspond to the list of dynamics objects in my engine. By default, objects are stored into a "scene" list that is the list of static objects).

And convex means that the geo (volume) of the object for the physics, must be build from the object's vertices. This generates a convex hull. For the moment, only "convex" is supported, but i could use primitives like "boxes", "cubes", "spheres" etc instead of a convex hull ...


The joints names start with a @.
Follows the joint type, here hinge.
Next, follow the name of the children object, and the name of the parent object :-)


And that's how i can build a scene directly into Wings3D which now build the script to load and destroy the scene :) It cans generate scripts of thousands lines that i jsut have to include into my other script and run to test it 8-)


I still have some work to do (like adding parameters to define mass etc), but it does work very well ^_^




I think that it is possible to make Wings3D exporting C/C++ (or even pascal/delphi) codes that can be included into watever project you want, so Wings3D would become a editor for projects that uses Newton.


If somebody is interrested about using Wings3D as Newton's scene editor to automatically generate codes (C/C++, Delphi or whatever you want) that can be included in his engine, we could try to establish a standard API for the generated codes :-)
Signature
registration information
 
Posts: 23
Joined: Thu Mar 31, 2005 8:14 am
Location: location

Postby Thomas » Sat May 21, 2005 10:31 pm

nice! i try to do something similar for blender. i would also like to be able to use physics within blender itself but i still struggle to get callbacks working with swig/python so there isn't much progress yet. :)
Thomas
Moderator
Moderator
 
Posts: 65
Joined: Sat Nov 01, 2003 1:51 pm
Location: austria

Postby registration information » Thu May 26, 2005 11:57 am

I tried Blender once, and i understood nothing :-P

Well ... i don't plan (and don't even think about) adding physics into Wings3D itself ... I'm not sure Erlang is a language made for realtime :-/


When i'll have some free time, what i would like to do, is to make Wings3D directly compiling scenes using gcc and some libs.

You create your scene, give mass and paramters to your objects, and places joint, all of that using Wings3D.
Then you export the scene and you get an executable with which you test your scene with Newton.

That would be fun :-)



====================

I've just added support for some new helpers in my current exporter, and i also made a custom fixed-joint (which seems to work correctly :-P)

So, i made a little gear to test it :)
Image[/img]


Now, i just have to add a parameter to set how joints break.
Signature
registration information
 
Posts: 23
Joined: Thu Mar 31, 2005 8:14 am
Location: location


Return to User Gallery

Who is online

Users browsing this forum: No registered users and 1 guest