New version of Box2D

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

Re: New version of Box2D

Postby sjkm » Mon Feb 04, 2013 9:09 pm

Oh... what I forgot to mention:
You get a less elastic rope by changing the key values of the verlet algorithm.
One of them is the gravity value. You can also overlap the segments in order to achieve an almost unelastic rope...
sjkm
 
Posts: 25
Joined: Sun May 20, 2012 12:43 pm
Location: Zurich, Switzerland

Re: New version of Box2D

Postby Mathew » Sat Feb 09, 2013 8:10 pm

Does LineJoint have its equivalent in this latest version of box2d?
User avatar
Mathew
 
Posts: 1073
Joined: Sun Jul 31, 2011 2:49 pm
Location: Tarnów, Poland

Re: New version of Box2D

Postby RealMayo » Sat Feb 09, 2013 8:18 pm

Line Joint has been replaced by Wheel Joint according to box2d.org
But Wheel Joint sucks from my experience. If you want to make a car, do this...(scroll past the "top down" car and instead look at the side view car example)....
http://www.emanueleferonato.com/2009/04/06/two-ways-to-make-box2d-cars/
User avatar
RealMayo
 
Posts: 1694
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

Re: New version of Box2D

Postby Mathew » Sat Feb 09, 2013 8:33 pm

Well its strange for me, that my game behaves bit different in this version, like messed up frictions and so on, weird.

Thanks RealMayo.
User avatar
Mathew
 
Posts: 1073
Joined: Sun Jul 31, 2011 2:49 pm
Location: Tarnów, Poland

Re: New version of Box2D

Postby korn3l » Mon Feb 11, 2013 10:32 am

RealMayo wrote:Line Joint has been replaced by Wheel Joint according to box2d.org
But Wheel Joint sucks from my experience. If you want to make a car, do this...(scroll past the "top down" car and instead look at the side view car example)....
http://www.emanueleferonato.com/2009/04/06/two-ways-to-make-box2d-cars/


Why do you say wheel joints suck ? From what I've read wheelJoint is the best solution for making a vehicle since it also provides a suspension spring. Have you tried the example from the testBed ? http://code.google.com/p/box2d/source/b ... ests/Car.h
There are also some nice examples of ropes and bridges.
korn3l
 
Posts: 214
Joined: Thu Apr 12, 2012 4:20 pm
Location: Iasi, Romania

Re: New version of Box2D

Postby RealMayo » Mon Feb 11, 2013 5:18 pm

Yes I converted that car.h code into AndEngine code and tried it and I tried to adjust the suspension. But I found the suspension to be either too rigid or otherwise too unstable when trying to make the suspension weaker. If you look at the way Emanuele made her car in that link I provided, and you see how the finished product behaves (you can actually test drive the car on that website), it is very realistic and awesome. I can't reproduce the feel of that awesome suspension by using Wheel Joints. Perhaps I was doing something wrong. But now its too late for me anyway since I've already created an Emanuele car in AndEngine.
User avatar
RealMayo
 
Posts: 1694
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

Re: New version of Box2D

Postby fechy » Wed Apr 24, 2013 11:56 pm

Somehow I'm not able to make this version work. As soon as 2 bodies collide, the app closes with nothing on LogCat.
With Nicolas' extension it works perfect.

some info:
- I'm using PhysicsEditorShapeLibrary to read PhysicsEditor's xml and build the bodies (some of them are polygons with more complicated structure than others)
- I check collitions on postSolve:
Something like:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void postSolve(Contact contact, ContactImpulse impulse) {
  2.    Body a = pContact.getFixtureA().getBody();
  3.     Body b = pContact.getFixtureB().getBody();
  4.  
  5.     if (!a.isAwake() || !b.isAwake()) {
  6.       Debug.i("Body already inactive!");
  7.       return;
  8.     }
  9.  
  10.     a.setAwake(false);
  11.     b.setAwake(false);
  12.     a.setActive(false);
  13.     b.setActive(false);
  14.  
  15.     if (a.getUserData().equals(null) || b.getUserData().equals(null)) {
  16.       return;
  17.     }
  18.    
  19.     final Entity aData = (Entity) a.getUserData();
  20.     final Entity bData = (Entity) b.getUserData();
  21.  
  22.     if (aData instanceof Shoot && bData instanceof Enemy) {
  23.       BulletHitsEnemy(a, b);
  24.     } else if (bData instanceof Shoot && aData instanceof Enemy) {
  25.       BulletHitsEnemy(b, a);
  26.     }
  27. }
  28.  
Parsed in 0.012 seconds, using GeSHi 1.0.8.4

- I am NOT using FixedStepPhysicsWorld, just normal PhysicsWorld
- Shoot is setBullet(true) <- not sure if this info makes any difference here :)

What may I have done wrong?

Thanks in advance!

Cheers
fechy
 
Posts: 47
Joined: Fri Sep 14, 2012 3:38 pm

Re: New version of Box2D

Postby RealMayo » Thu Apr 25, 2013 12:00 am

If by chance you are using GLES2 then I've got this new box2d branch plus everything else, working perfectly in my github. You could try downloading everything from my github.
User avatar
RealMayo
 
Posts: 1694
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

Re: New version of Box2D

Postby nazgee » Thu Apr 25, 2013 1:15 pm

I am working on a game massively using complicated fixtures and a dozen of joints (rope joint, wheel joints, distance joint, weld joint, etc...). Everything works great. Here is the interesting part of setup from my (repo manifest file):

<default revision="GLES2-AnchorCenter"
remote="github-git" />

<!-- andengine core + extensions -->

<project path="AndEngine"
name="nicolasgramlich/AndEngine.git" />

<project path="AndEnginePhysicsBox2DExtension"
name="RealFictionFactory/AndEnginePhysicsBox2DExtension.git" />

<project path="AndEngineRubeLoaderExtension"
name="nazgee/AndEngineRubeLoaderExtension.git" />

<project path="AndEngineDebugDrawExtension"
name="nazgee/AndEngineDebugDrawExtension.git"
revision="GLES2-AnchorCenter-latest-B2D" />


To summarise:
B2D from RealFictionFactory @ GLES2-AnchorCenter
AE from nicolasgramlich @ GLES2-AnchorCenter
RubeLoader from nazgee @ GLES2-AnchorCenter
AndEngineDebugDrawExtension from nazgee @ GLES2-AnchorCenter-latest-B2D

I would guess that you have a "regular B2D issue" that... did not appear for some strange reason on an old version...
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: New version of Box2D

Postby fechy » Thu Apr 25, 2013 1:30 pm

RealMayo wrote:If by chance you are using GLES2 then I've got this new box2d branch plus everything else, working perfectly in my github. You could try downloading everything from my github.

Yes, I'm using GLES2 and everything from github. Still can't figure what it is since there's no error at all. Can it be that I'm processing the contacts on postSolve? I'll post more of my code later when I come back home.
fechy
 
Posts: 47
Joined: Fri Sep 14, 2012 3:38 pm

PreviousNext

Return to Features

Who is online

Users browsing this forum: Google [Bot] and 3 guests