Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (117)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Character_Object..Is it possibble to initialize with no acting forces at all  (Read 894 times)
0 Members and 1 Guest are viewing this topic.
Offline lukethor

Innocent Bystander





« Posted 2012-02-28 14: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]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

Grunnt (12 views)
2014-09-23 14:38:19

radar3301 (13 views)
2014-09-21 23:33:17

BurntPizza (31 views)
2014-09-21 02:42:18

BurntPizza (22 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (29 views)
2014-09-20 20:14:06

BurntPizza (33 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (75 views)
2014-09-10 13:57:51

TehJavaDev (105 views)
2014-09-10 06:39:09
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!