box2d

Libgdx box2d body moves slow

折月煮酒 提交于 2019-12-19 09:30:34
问题 This is a very simple scene with box2d. I tried different viewports and different screen sizes. I could not figure out why the body drops very slow. Actually, I am not quite sure that it is slow, the reason is maybe the viewport settings etc. This is main class: public class Main extends Game { LevelScreen levelScreen; @Override public void create () { levelScreen = new LevelScreen(); setScreen(levelScreen); } @Override public void render () { super.render(); } } And level screen: public

box2d collision groups

被刻印的时光 ゝ 提交于 2019-12-18 20:04:14
问题 does anyone know whether bodies only collide when (body1.categoryBits & body2.maskBits) && (body1.maskBits & body2.categoryBits) ? or do they already collide when (body1.categoryBits & body2.maskBits) || (body1.maskBits & body2.categoryBits) ? 回答1: If anyone is still looking for more explanations, I made a detailed tutorial here : http://aurelienribon.wordpress.com/2011/07/01/box2d-tutorial-collision-filtering/ 回答2: From the Box2D manual: 6.2.3. Filtering Collision filtering is a system for

How to properly delete a box2d body in version: Box2dWeb-2.1.a.3, Box2D_v2.3.1r3? Box2D bug?

ε祈祈猫儿з 提交于 2019-12-18 13:31:32
问题 Update Since the problem has been found I've also find out that Box2D for web is leaking on every side :/ To show this I made a simple circle moving in a static polygon and here is the result after some time. Notice how the following items are leaking as I'm not creating any body or changing the world in any way: b2Vec2 Features b2ManifoldPoint b2ContactID b2Manifold b2ContactEdge b2PolyAndCircleContact Array ... Original post I have a problem because I'm profiling my game and the garbage

2d trajectory planning of a spaceship with physics

丶灬走出姿态 提交于 2019-12-18 10:24:50
问题 I'm implementing a 2D game with ships in space. In order to do it, I'm using LÖVE, which wraps Box2D with Lua. But I believe that my question can be answered by anyone with a greater understanding of physics than myself - so pseudo code is accepted as a response. My problem is that I don't know how to move my spaceships properly on a 2D physics-enabled world. More concretely: A ship of mass m is located at an initial position {x, y} . It has an initial velocity vector of {vx, vy} (can be {0,0

How to compile Box2D in Linux?

≯℡__Kan透↙ 提交于 2019-12-18 09:04:41
问题 Compiling the Box2d Tesbed is supposed to be simple: from iforce2d: Download the Box2D source code archive from here. If you want to use the terminal all the way, you could also do this (if wget is not available, use yum to install it): wget http://box2d.googlecode.com/files/Box2D_v2.1.2.zip Use the following commands to unzip and build it. [...] unzip Box2D_v2.1.2.zip cd Box2D_v2.1.2/Box2D/Build cmake .. make ( These instructions are pretty old, I did get my source with git clone https:/

Applying a vortex / whirlpool effect in Box2d / Cocos2d for iPhone

元气小坏坏 提交于 2019-12-18 07:19:33
问题 I've used Nick Vellios' tutorial to create radial gravity with a Box2D object. I am aware of Make a Vortex here on SO, but I couldn't figure out how to implement it in my project. I have made a vortex object, which is a Box2D circleShape sensor that rotates with a consistent angular velocity. When other Box2D objects contact this vortex object I want them to rotate around at the same angular velocity as the vortex, gradually getting closer to the vortex's centre. At the moment the object is

How to not allow kinematic physics bodies to pass through static bodies?

本小妞迷上赌 提交于 2019-12-14 02:26:18
问题 My game scene consist of four walls, which are static bodies, and one platform plate, which is of type kinematic and slides only horizontally, something like the picture below. The platform body moves based on acceleration sensor, see this codes @Override public void onAccelerationChanged(AccelerationData pAccelerationData) { mPlatformBody.setLinearVelocity(pAccelerationData.getX() * 10, 0); } My problem is when the platform goes off the boundary walls, which it should not. For resolving this

How to implement mouse joint in Sprite Kit?

岁酱吖の 提交于 2019-12-14 01:43:38
问题 I have working implementation of drag and drop feature written in Cocos2d + Box2d for iOS. I need to port it to Sprite Kit. The logic is pretty basic: when user touching the screen, find sprite under the finger create mouse joint between found sprite and the scene's physics body, set joint's target to position of touch when touches moved, update joint's target to new position when touches ended, remove the joint Everything is working quite well. I like the way physics is simulated when

How to create “circles” in Box2D?

余生长醉 提交于 2019-12-13 23:51:59
问题 I want the circle with box2d in video. http://goo.gl/39Ff3 回答1: Did you check this site? There seems to be much tutorials. And don't forget the manual especially 4.2 Circle Shapes. Circle Shapes Circle shapes have a position and radius. Circles are solid. You cannot make a hollow circle using the circle shape. b2CircleShape circle; circle.m_p.Set(2.0f, 3.0f); circle.m_radius = 0.5f 来源: https://stackoverflow.com/questions/10264012/how-to-create-circles-in-box2d

Box2d :roll soft body ball

让人想犯罪 __ 提交于 2019-12-13 19:23:43
问题 I made a soft body ball int box2d that looks like that: Every point of the circle is a box2d body and every line is a distance joint. How can i roll it? I don't want to change the world gravity and just let it roll , I want it to start spinning from the center (not every circle point independent). I just need the geeneral idea ,not code. 回答1: The general idea is to apply the right force to each body. If you want rotation - these forces are normals to the vectors from the center of the ball to