Put Physics Material Parameters into .j3m file

How about declerative PhysicsObjects? or at least PhysicsMaterials.



I don't now if integrating this into a "normal" material file, but maybe we could make an similiar system for setting declarative PhysicsMaterials.

So Damping, Friction, Gravity, Kinematic, etc… will all be declared in an .j3m or sth like this file.

MaterialDef Physic Material {

    MaterialParameters {

        Boolean p_Kinematic
        Float p_Mass

        Float p_Friction
        Float p_Restitution

// maybe Vector2 instead?
        Float p_AngDamping
        Float p_LinDamping

        Float p_AngSleepingThreshold
        Float p_LinSleepingThreshold
    }


}



This also adds the opportunity to add a simple Shader, which can make use of the declared attributes during debug.

Opinions would be nice :-]

Nah, I dont think this is a good idea.  :) First of all, the j3o or jmexml formats are the preferred format to store jme data. The material and materialdef files are there because of their close bounds to shader frag and vert files.

If you want physics options before import I'd say going with the properties that can be put into ogrexml would make more sense. I already used it in a private project, setting values in blender and reading them with the sceneimporter to create physics opjects and set parameters while importing. Only problem here is that their use is not standardized. So for example blender can set these but the maya exporter cannot…



Cheers,

Normen



Edit: Also, jbullet physics are still implemented in a way that makes it possible to exclude them from jme3. Interweaving it with the material system would make that impossible pretty soon. And then when with v2.0 physics you have natives that might not run on your platform > problems :slight_smile:

I see.

It was more like a quick… hm… Ghost-lightning^^ (I don't know the english word for this, but you germans will understand :D)

We do need to store these physics parameters somewhere… But I don't think the J3M is a good place to do that. You would probably want to associate physics properties with objects, and not materials. Storing UserData inside the .scene file would be the easiest option. You can also store them inside a custom entity data format.

Momoko_Fan said:

We do need to store these physics parameters somewhere.. But I don't think the J3M is a good place to do that. You would probably want to associate physics properties with objects, and not materials. Storing UserData inside the .scene file would be the easiest option. You can also store them inside a custom entity data format.


Now,
I happen to store 'em in a Plain old Java Property file and quite happy with it :)
tim8dev said:

Now,
I happen to store 'em in a Plain old Java Property file and quite happy with it :)

When do you need to store them? Would j3o or jmexml not work for you?

I define it per hand within property files.