Tag Info

New answers tagged

0

You simply need to define the water, the same way you define the skies for lighting purposes. You may or may not need to duplicate the world simulation for lighting if you want water to behave different from solids.


0

That happens in native body creation, and in your code only these lines are directly connected with that: BodyDef bodyDef = new BodyDef(); bodyDef.type = BodyDef.BodyType.DynamicBody; bodyDef.gravityScale = 0.5f; SetBody(app.world.createBody(bodyDef)); Box2d manual recommends to set body positions from the beginning, avoiding putting multiple bodies to ...


1

Box2d has a body type that fits your need: KinematicBody. Kinematic bodies aren't affected by collisions, you programmatically set their velocity from outside of Box2d. Also you can directly set their positions, instead of manipulating their speed, though it's not recommended. In case when you set kinematic bodies' speed, their position is still controlled ...


4

The most common approach to this is to detect if the character is standing on a solid surface before allowing them to jump. This restricts players to a single jump since the first jump puts them in the air, then they're no longer on a solid surface, so the next time they try to jump, they can't. For Box2D specifically you can see how to implement that here: ...


1

I think the only way to achieve a good result with Box2D is scaling things down. I use two OrthographicCameras for my games, one for HUD stuff and another to Box2D related stuff. Also, I use methods for scaling images and elements down. Here's an example of what I'm talking about. (It's not a working example. Just illustrating...) private final float SCALE ...


0

I am working on my own level editor Fire Ant Box2d Level editor, is free, please feel free to try it out, it exports your work to ios code as well as xml so you only write a small xml processing routine and you should be able to use it in andengine. It also generates optimized texture tiles out of the box. http://www.freefable.com ...


1

One way to do this is create a kinematic body for each dynamic body as a 'shadow' body, with exactly the same fixtures. After very time step, set the position, angle, linear velocity and angular velocity of the kinematic body to match that of the dynamic body it is shadowing. The original dynamic fixture should be set to not collide with its own shadow ...


0

you can simply use the box2d editor to match your sprite sheet with the body fixture there is a powerful application who do this for you : LINK you can : Automatically decomposes concave shapes into convex polygons, Automatically traces your images if needed, Supports multiple outlines for a single body, Supports polygon and circle shapes, Reference ...


0

If you arent going (or can't because of software limitations) to remove the extra pixels you could go into the original sprite sheet and move the image of the crouching soldier down. The problem is that you won't have accurate collision detection if you are keeping those extra pixels so crouching might be useless.


0

The answer is an obvious no simply because "heavy rounding" doesn't alleviate the problem. Like you suggested the issue is with how floats behave on different architectures. Lets say you round things up. :) What happens with very large numbers? They are still exactly the same. Large numbers behave differently too on different architectures. Fractions, are ...


0

One way to align it back is to check it's current orientation. float bodyAngle = body->GetAngle(); Compare it with the desired angle: float delta = desiredAndle - bodyAngle; Then use applyTorque with a tiny amount to slowly increase the speed in that direction If the angular speed is too high, stop increasing the speed: if (delta > SMALL_ENOUGH) ...


1

Yes - you can use the Marching Squares algorithm to detect the bounds of the image within the frame, and then I would suggest storing the actual bounds (height/width) somewhere. Particularly if your sprites contain islands, as this can take a long time to locate all the little pieces in the frame. Ideally, you would repack your spritesheets into an atlas so ...


0

How big or small are your objects? Maybe the problem is with float precision? This would explain that the problem does not occur when you are not using PPM


1

Your problem is that the physics library, probably Box2D, supports only convex shapes. You are passing in a non-convex (concave) shape, and what you get as a result is that the convex hull of your shape is used as collision body. To avoid this, you can either manually make sure your collision primitives are convex, or you can triangulate the polygon (there ...


0

It works now! I have created a seperate Box2D world for every planet and Solar Systems. The Solar System rotates the planet, so it looks like the planet is rotating. But the player (in the world) isn't rotating at all. The result looks like this: http://imgur.com/rPM3OgV



Top 50 recent answers are included