Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Game Mechanics / Character_Object..Is it possibble to initialize with no acting forces at all on: 2012-02-28 15:57:39
I am working on a game that introduces a Jbullet Character_object every certain amount of time into the physics world. The physics world only contain Static_Objects besides the character objects being introduced. Here are the two game states.

Stable state - I introduce only one Character_object into the system every 10 seconds , the game does not slow down the frames per second at all.

Unstable system
- Enter a Character_object every three seconds. The games becomes slow and the FPS slow down  from 60 FPS  to 8 FPS. The system never recovers again.

The desired system is to be able to enter into the physics world a character_object every three seconds. Is there any way to enter into the world a character_object that does not introduce any force at all while the velocity of the object falls to a certain threshold ?



Here are the constructors for the Character_Object and the Static_object :

   public Character(String name, String filepath,Vector3 pos) {

      
      //Get box dimensions from libgdx
      Vector3 boxDims = box.getDimensions();
      
      //Character shape, so construct the half extents and convert to JBullet's Vector type
      Vector3f halfExtents = new Vector3f(boxDims.x/2,
                                 boxDims.y/2,
                                 boxDims.z/2);
      CylinderShape shape = new CylinderShape(halfExtents);
      
      rigidBody = Physics.constructRigidBody(shape,
                                             1,
                                             pos.x,
                                             pos.y,
      rigidBody.setFriction(0.6f);
                // Just bouncy
      rigidBody.setRestitution(0.5f);
      rigidBody.setDamping(0.10f,0.80f);   
      
      rigidBody.setCollisionShape(shape);
      rigidBody.setCollisionFlags( rigidBody.getCollisionFlags() | CollisionFlags.CHARACTER_OBJECT);
      
      
   }


public StaticMeshObject(String name, String filepath,Vector3 pos) {
      
   
      
      meshInterface = new TriangleIndexVertexArray();      
      
      trimesh = new IndexedMesh();
   
      
      meshInterface.addIndexedMesh(trimesh);
      BvhTriangleMeshShape meshShape = new BvhTriangleMeshShape(meshInterface, true, true)
      rigidBody = Physics.constructRigidBody(meshShape,
                                 0,
                                 pos.x,
                                 pos.y,
                                 pos.z);
   
      
      rigidBody.setCollisionFlags(rigidBody.getCollisionFlags() | CollisionFlags.STATIC_OBJECT);
   
      
      
   }
Pages: [1]
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (33 views)
2013-05-17 21:29:12

alaslipknot (42 views)
2013-05-16 21:24:48

gouessej (72 views)
2013-05-16 00:53:38

gouessej (71 views)
2013-05-16 00:17:58

theagentd (79 views)
2013-05-15 15:01:13

theagentd (74 views)
2013-05-15 15:00:54

StreetDoggy (114 views)
2013-05-14 15:56:26

kutucuk (138 views)
2013-05-12 17:10:36

kutucuk (138 views)
2013-05-12 15:36:09

UnluckyDevil (146 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.079 seconds with 21 queries.