Liquid Fun - Box2D became even better - SUCCEED !!!

  ... the case you feel the need for a new feature or want to submit one.

Re: Liquid Fun - Box2D became even better - SUCCEED !!!

Postby bugman000 » Tue Jun 03, 2014 10:53 pm

Is there any chance that this liquidfun extension for AndEngine can be ported to AC?
bugman000
 
Posts: 1
Joined: Tue Jun 03, 2014 10:52 pm

Re: Liquid Fun - Box2D became even better - SUCCEED !!!

Postby rickyalbert » Sat Jul 05, 2014 4:18 pm

Hi, I am new in AndEngine programming and I really felt in love with liquidfun.
May I ask which is the best implementation you found for displaying the water mesh ?
Thank you everybody!
Riccardo
rickyalbert
 
Posts: 3
Joined: Sat Jul 05, 2014 11:30 am

Re: Liquid Fun - Box2D became even better - SUCCEED !!!

Postby GuilhE » Tue Aug 05, 2014 1:03 am

bugman000 wrote:Is there any chance that this liquidfun extension for AndEngine can be ported to AC?


Here you have it, the latest version of AndEnginePhysicsBox2DExtension with GLES2-AnchorCenter-LiquidFun right nazgee? :)
GuilhE
 
Posts: 23
Joined: Fri Nov 16, 2012 4:26 pm

Re: Liquid Fun - Box2D became even better - SUCCEED !!!

Postby nazgee » Mon Oct 13, 2014 11:53 am

Yes, I have working liquid-fun on my branch. Just be aware that:
- it is version 1.1.0 (currently latestl. yay!
- checkout the correct branch (most of the retarted "it does not work" is caused by checking out incorrect branch
- mesh for rendering of particles is completerly orthogonal problem. I have a mesh that is work in progress. I will put it in my Limbo extension when it it's ready

https://github.com/nazgee/AndEnginePhys ... -LiquidFun
Dirt Rider Mayhem is PUBLISHED now!
Image
User avatar
nazgee
 
Posts: 527
Joined: Fri Oct 21, 2011 10:31 pm
Location: Poland, Wrocław

Re: Liquid Fun - Box2D became even better - SUCCEED !!!

Postby massinissa » Fri Dec 05, 2014 7:44 pm

Hi nazgee

Firstly i want to thank all persons who participate in this great work :) ,

i have tried to make water simulation whith this extention of andengine , so i created my physicWorld and parcelSystem like mentioned by valka previousely

So i succeed to disply particle water on the Scen but

the problem : the particle dont react with bodies also the particles are slower than other bodies in gravity force.

this is my code of particles :

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  final int maxParticleCount = 1000;
  2.          final int particleRadius = 100;
  3.          ParticleSystemDef parS=new ParticleSystemDef();
  4.          
  5.          particleSystem = new ParticleSystem(mPhysicsWorld, parS);
  6.          particleSystem.setParticleMaxCount(maxParticleCount);
  7.        
  8.          ParticleGroupDef groupDef = new ParticleGroupDef();
  9.          groupDef.flags.add(ParticleType.b2_elasticParticle);
  10.          groupDef.position.set(CAMERA_WIDTH/2,CAMERA_HEIGHT/2);
  11.        
  12.          PolygonShape parShape = new PolygonShape();
  13.          parShape.setAsBox(8f,16f);
  14.          groupDef.shape = parShape;
  15.          groupDef.linearVelocity.set(0f, 0f);
  16.          particleSystem.setParticleRadius(particleRadius); // CHANGE TO PHYSICS CONSTANT !!!
  17.          particleSystem.createParticleGroup(groupDef);
  18.        
  19.        
  20.           particles = new DynamicSpriteBatch(ResourcesManager.getInstance().waterParticleTextureAtlas, maxParticleCount, this.getVertexBufferObjectManager()){
  21.                      @Override
  22.                      protected boolean onUpdateSpriteBatch() {
  23.                              final float[] particlesPos = particleSystem.getParticlePositionBufferArray(true);
  24.                              for(int i=0;i<particlesPos.length/2;i++)
  25.                              {
  26.                                      this.draw(waterParticle_region, particlesPos[i*2]-particleRadius, particlesPos[i*2+1]-particleRadius, 2f*particleRadius, 2f*particleRadius, 0f, 0.5f, 0.65f, 1f, 1f);
  27.                              }
  28.                              return true;
  29.                      }
  30.          };
Parsed in 0.013 seconds, using GeSHi 1.0.8.4


this how i attached it to the scene

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public Scene onCreateScene() {
  2.                 this.mEngine.registerUpdateHandler(new FPSLogger());
  3.                 this.mScene = new Scene();
  4.                 this.mScene.getBackground().setColor(Color.BLACK);
  5.                 this.mPhysicsWorld = new PhysicsWorld(new Vector2(0, -SensorManager.GRAVITY_EARTH), false);
  6.  
  7.                 final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
  8.                 final Rectangle ground = new Rectangle(CAMERA_WIDTH / 2, 1, CAMERA_WIDTH, 2, vertexBufferObjectManager);
  9.                 final Rectangle roof = new Rectangle(CAMERA_WIDTH / 2, CAMERA_HEIGHT - 1, CAMERA_WIDTH, 2, vertexBufferObjectManager);
  10.                 final Rectangle left = new Rectangle(1, CAMERA_HEIGHT / 2, 1, CAMERA_HEIGHT, vertexBufferObjectManager);
  11.                 final Rectangle right = new Rectangle(CAMERA_WIDTH - 1, CAMERA_HEIGHT / 2, 2, CAMERA_HEIGHT, vertexBufferObjectManager);
  12.  
  13.                 final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0, 0, 0);
  14.                
  15.                 PhysicsFactory.createBoxBody(this.mPhysicsWorld, ground, BodyType.StaticBody, wallFixtureDef);
  16.                 PhysicsFactory.createBoxBody(this.mPhysicsWorld, roof, BodyType.StaticBody, wallFixtureDef);
  17.                 PhysicsFactory.createBoxBody(this.mPhysicsWorld, left, BodyType.StaticBody, wallFixtureDef);
  18.                 PhysicsFactory.createBoxBody(this.mPhysicsWorld, right, BodyType.StaticBody, wallFixtureDef);
  19.  
  20.                 this.mScene.attachChild(ground);
  21.                 this.mScene.attachChild(roof);
  22.                 this.mScene.attachChild(left);
  23.                 this.mScene.attachChild(right);
  24.  
  25.                
  26.                 //mCellFixtureDef = PhysicsFactory.createFixtureDef(0, 0, 0);
  27.                 createParticleSystems(ResourcesManager.getInstance().waterParticle_region);
  28.                
  29.                
  30.                 //mScene.attachChild(mCampFireParticleSystem);
  31.                 //mScene.attachChild(particles);
  32.                  //WaterMesh test
  33.         final WaterMesh waterMesh = new WaterMesh(particleSystem, ResourcesManager.getInstance().vbom);
  34.         this.mScene.attachChild(waterMesh);
  35.                 this.mScene.registerUpdateHandler(this.mPhysicsWorld);
  36.                 return mScene;
  37.         }
Parsed in 0.012 seconds, using GeSHi 1.0.8.4
massinissa
 
Posts: 2
Joined: Fri Oct 31, 2014 1:33 pm

Re: Liquid Fun - Box2D became even better - SUCCEED !!!

Postby massinissa » Fri Dec 05, 2014 10:23 pm

Ok !!

I found the solution :

it's weared ; when i changed the difinition of ground from this
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. final Rectangle ground = new Rectangle(CAMERA_WIDTH / 2, 1, CAMERA_WIDTH, 2, vertexBufferObjectManager);
  2. PhysicsFactory.createBoxBody(this.mPhysicsWorld, ground , BodyType.StaticBody, wallFixtureDef);
  3.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


to this
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. BodyDef bodyDefg = new BodyDef();
  2.                 bodyDefg.type = BodyType.StaticBody;
  3.                 bodyDefg.position.set(CAMERA_WIDTH / 2, 1);
  4.                 //bodyDef.angle = (float) Math.toRadians(-30);
  5.                 Body groundBody = mPhysicsWorld.createBody(bodyDefg);
  6.                
  7.                 PolygonShape shape = new PolygonShape();
  8.                 shape.setAsBox( CAMERA_WIDTH / 2, 1);
  9.                
  10.                 FixtureDef fixDef = new FixtureDef();
  11.                 fixDef.friction = 0;
  12.                 fixDef.shape = shape;
  13.                 groundBody.createFixture(fixDef);
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


now it works, i think the PhysicsFactory.createBoxBody dont reconize parcelsystem (liquidfun) yet perhaps it's an issue in box2d actual version ??
massinissa
 
Posts: 2
Joined: Fri Oct 31, 2014 1:33 pm

Re: Liquid Fun - Box2D became even better - SUCCEED !!!

Postby Sergio » Wed Dec 17, 2014 2:28 pm

Wow, liquid fun seems actually... FUN! haha

Great work there porting it, guys. I want to play with that and see how it works.
Image
Sergio
 
Posts: 14
Joined: Wed Jul 10, 2013 6:12 pm

Re: Liquid Fun - Box2D became even better - SUCCEED !!!

Postby fatal » Mon Aug 17, 2015 11:49 pm

Hi,

Looking great :)

I've downloaded nazgee's branch (yes, it's the correct one), replaced reference in my project to the new one. Everything is fine, except my ContactListener doesn't work at all. It never enters to the beginContact method. Before upgrade, with the old AndEnginePhysicsBox2DExtension, everything was fine. Anybody has any idea what did I miss, or what could went wrong?

Thanks!

Edit: I've fixed the problem by updating to this commit: "Updated to liquidfun 1.1".

Something is wrong with particle system or collision filtering changes.

Anyway huge thanks for anyone who port this stuff andengine :)
User avatar
fatal
 
Posts: 488
Joined: Sun Jan 08, 2012 2:20 am
Location: Budapest, Hungary

Previous

Return to Features

Who is online

Users browsing this forum: No registered users and 8 guests