Tag Info

Hot answers tagged

1

In this line ball.applyLinearImpulse(new Vector2(0f, 5000f), ball.getPosition(), true); I think the point where you put force it relative to object position, so you put impule in ball.getPosition() + ball.getPosition() Try to use public void applyForceToCenter(Vector2 force, boolean wake) or ball.applyLinearImpulse(new Vector2(0f, 5000f), new ...


1

Imagine that you have a class that represents a permeable object (in pseudocode): class permeableObject { b2RigidBody body; //this holds the actual box2D rigid body //this is a virtual function; it will be override by derived classes vec2 getExertedForce(vec2 point); //... //functions such as constructor, setBody, etc } Then, you ...


1

If in your game there are only a couple of objects that could possibly go outside of your game limits, you don't have to add rectangles to set the boundaries in your game unless it somehow makes your code cleaner in your case. Efficiency-wise I guess the old fashioned if (object1.Position.X < 0) qualifies as the left boundary in your game. If you have ...


1

If the circles never need to move independently, you can make one body. See here for an example of a hexagon body. I've extracted the relavent bits and pasted them here: import static org.anddev.andengine.extension.physics.box2d.util.constants.PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT; import com.badlogic.gdx.math.Vector2; import ...


1

Try fetching the position buffer: Vec2[] positions = m_world.getParticlePositionBuffer(); additionally you might want to grab the colors: ParticleColor[] colors = m_world.getParticleColorBuffer(); Then I would draw the corresponding color at every position using OpenGL. I believe that you can write a very simple shader that would work very well for ...


1

For completeness, I'll document the "reinventing the wheel" approach. I recently wanted to do this too, but I wanted to do it statically (due to some code-structure decisions made before that I didn't want to break). So I didn't want to create a sensor body and World.Step, as previously suggested. Instead, I figured that a convex polygon intersects with a ...



Only top voted, non community-wiki answers of a minimum length are eligible