Physical features (question)

Hello,

I need to using physics on my games, but I’m limited, maybe, by me or by jME3.

I need to make a flag using cloth physics and I need deformation object like sponge and crash object.

I was searched into jME3 examples but without any result.

Does anyone have any idea, How can I do this?

I have still a question.

I have imported an object cube.mesh.xml and I change the xml file, while running the game.

How can I update the 3D object in real-time for display the modifications of cube.mesh.xml?

For example: Using simpleUpdate void or pressing a key.

Happy coding with jMonkeyEngine!

There is no softbody physics in jME3 yet, about the other questions, I don’t quite understand you…

I am not happy to hear that jMonkeyEngine not contain complete physical, but I hope in a better future.



But, first, thank you, normen, for your promptly reply.



I apologize for the poor explanation of my problem, so I will explain this issue in detail.



I have an 3D object, for example a cube. This cube has more polygons.

I want to create a small Physics framework for jMonkeyEngine.

This framework can deform objects, for example, if a gun fires a bullet into an object, that object will deform.

Another example: This framework will deform an object like a cloth or sponge effect.

How it works?

Initial object:

See image!

I exported the object into Ogre XML format, called Cube.001.mesh.xml

This file contains some information about 3D object, in this case a cube.

For example:

[xml]<mesh>

<submeshes>

<submesh material=“BaseWhite” usesharedvertices=“false”>

<faces count=“3072”>

<face v1=“0” v2=“1” v3=“3”/>

<face v1=“1” v2=“2” v3=“3”/>

<face v1=“4” v2=“0” v3=“5”/>

<face v1=“0” v2=“3” v3=“5”/>

<face v1=“3” v2=“2” v3=“7”/>

<face v1=“2” v2=“6” v3=“7”/>

<face v1=“5” v2=“3” v3=“8”/>

<face v1=“3” v2=“7” v3=“8”/>

<face v1=“9” v2=“4” v3=“10”/>

<face v1=“4” v2=“5” v3=“10”/>

<face v1=“11” v2=“9” v3=“12”/>

<face v1=“9” v2=“10” v3=“12”/>

<face v1=“10” v2=“5” v3=“13”/>

ETC[/xml]

My framework modify the content of xml:

Old: [xml]<face v1=“11” v2=“9” v3=“12”/>[/xml]

replace with: [xml]<face v1=“00” v2=“0” v3=“0”/>[/xml]

But, this is only an example, the framework will change these digits by an algorithm.

Here I will show some possibilities of deformation:

  1. See image!

    In this case it will replace any digits with 0 from specified zone of xml content.

    In other words, it will removes the faces of cube from any zone specified.
  2. See image!

    In this case it will replace any digits with increased value (value++) for move edges and faces of cube.
  3. See image!

    This case it’s similar to above case, case 2, but here the object is modified in real-time for creating the cloth effect.

    So, Go into the core of my problem.

    If I modify content of cube.mesh.xml while running the game, How can I update the object from game (cube.mesh.xml) with new modifications of the object during the game?

    For example, the game running now and the Physics Framework modify the content of cube.mesh.xml and it save the modifications over file cube.mesh.xml - The game is updating the object every few seconds and when the object was modified the differences appear in real-time.

    I hope you understand what I meant to say to you.

    How can I do this?

Again, jbullet does not support softbodys, which is basically what you describe. Softbodys will be available and GPU accelerated when physics moves to native bullet. You will have to simulate this otherwise using geometry raytests.

Why don’t you just update the “Mesh” object stored in the Geometry? All the data is there, plus its a lot more efficient than reloading the file each time.

This is my problem. I don’t know how to update the object stored in the Geometry.

Want to tell me how to do this? :slight_smile:

Read this tutorial:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_meshes

Thank you, Momoko_Fan for help. I know about this tutorial, but I can’t observe where is code for updating an Geometry object, but maybe it’s object.updateBound(); - I will try it. But, I want to modeling an 3D object using Blender and then export as Ogre mesh and load it into the game and modify the object with my method or new this method (custom meshes). I do not want to create a new mesh from zero in jME.

You have any idea on this?

When you read the custom meshes tutorial you will learn about the actual buffers that make up a mesh and you can then modify the mesh you imported from blender.