Collision and Bricks falling through Worlds


im new to the JME and rather new to 3d programming at all…

So i modified the beginners tutorial 13 (HelloPhysics) where you can shoot a brickwall.

The first: i modified the Sphere (cannonballs) size to 0.05 from 0.4 and now it does not allways collide with the bricks or the floor it just goes through it. Any possibility to fix that?

The second is i want to have more than one wall and i want this walls in different BulletAppStates (to easily deactivate physics of one of the Walls) but when i have them in different States they dont interact wih the floor which is in anothr state. (For testing i only added one wall to a diffrent appState)

Thanks for any advice :slight_smile:

A) use CCD for that, something like rigidBody.setCcdMotionThreshold(ballradius/2);

B) does not work like that, one bulletAppState represents one PhysicsSpace. Add/remove the physics objects in your AppStates add/remove method so that when it gets added it also adds the physics objects.

Ok ill try that A)

What i want to have is 2 towers of about 100 bricks each in a 2 player game. To get some performance (it laggs on my computer) i want to 1 of the towers wach turn. My suggestion to that was giving each tower his own AppState and disable/aktivate one at each time. But this does not seem to work like i think ;). Is there anyway to do that with an eye on performance?

Simply have two floors in the background. Attach two RigidBodyControls to the spatial and add one to the one physics space and the other to the other one. This only makes sense when you set the threading mode to PARALLEL though.

ok so that means i have to attach everything both Players can interact with to both controls? I think thats not realy reasonable for what i want to do and there should be an easier way and also i want to do something with that bricks so i need them somewhere saved under a collection or whatever. Isnt it possible to atach and detach collections all at once?

oh and setting the Ccc thing works fine but only if i set both :slight_smile: Thnaks for that

Not everything, just the floor. If you need everything colliding with everything else separate physics spaces just don’t make sense.

Ok some more :slight_smile:

  1. Is it possible to get a List of anonymus objects from the physics space with a specified name? (For example all boxes called “brick”)?
  2. do i have to detach everything from the rootnode and physicsspace my self? i.e. this cannonballs falling of the platform?

    What i want to do is count the bricks falling off from the platform.
  1. Just keep a list of what you add
  2. Yes

Ok thx 4 that again.