box2d

How to keep the same jump height in libgdx

让人想犯罪 __ 提交于 2019-12-11 04:39:25
问题 I'm developing a 2D video game using libgdx. I ran into a problem when I try to make jumping a body. It does not jump as expected after making it moving to the right.(I can only move to the right or Jump) If the body jumps before it's moving to the right everything goes fine. But If I decide to make jumping the body after moving it to the right. The body no longer jumps to the same height (It jumps less high). And I don't figure out why.. My method to jump the body : if (player

Adding Sprites to the body using Box2d

百般思念 提交于 2019-12-11 04:38:24
问题 I am trying to create an app like a CutTheRope. In My game,if i cut the rope,then i want to add sprites to the individual broken bodies.how to accomplish it. Thanks.... 回答1: It totally depends how you are breaking your b2Body. I will answer the question according to the most feasible way to break body which is by creating multiple Fixtures on a body. When your body breaks, you destroy a fixture from your main body and recreate that fixture into a new b2Body. In box2d, the "Body", "Fixture"

Draw font on top of box2d body

浪子不回头ぞ 提交于 2019-12-11 02:55:13
问题 How can I draw text (font) on top of my static box2d body? Background: Im able to draw sprites on top of bodies correctly. I do this by having a box2dSpriteBatch which is projected on box2dCamera like so box2dSpriteBatch.setProjectionMatrix(box2dCamera.combined); And then simply rendering the sprite in the correct spot using getPosition of the body. But if i try the same way for fonts, unfortunately it scales incredibly large, and if i try to scale the font down it doesn't appear. So im

How to combine Box2d bodies?

可紊 提交于 2019-12-11 01:54:06
问题 I have a texture which is not just a box or circle and my body needs to be the same of this shape so I was thinking to combine multiple bodies to achieve my desired shape, is it even possible? or there are better ways to do it? I'm using java with libgdx framework. 回答1: The shape of body is being defined by Fixture instance. Since body can have multiple fixtures you can combine many shapes as you wish. To create many fixtures you jest call createFixture method many times with others

Any way to implement deterministic physics in AS3?

守給你的承諾、 提交于 2019-12-10 19:26:24
问题 It seems like Box2D for actionscript 3 is not deterministic, it means, in the event of a multiplayer game wheere physics plays an important role in determining who wins/loses, the results would be different for each user if their microprocesors are from different technologies (intel and amd for example). So, is there a way to implement deterministic physics in AS3?, was this achieved before?. Thanks. 回答1: I once had this problem. We used Havok engine in Shockwave Director to simulate a

Getting contact points on bodies in Cocos2d & Box2d

醉酒当歌 提交于 2019-12-10 19:11:48
问题 I'm very new to Cocos2d and Box2d, I have been following tutorials and generally hacking. However, I have one problem I cannot solve. I create 2 bodies and fixtures (in the Box2d world) and create a "Contact Listener" object. This object stores a list of contacts along with the "contact point". When the two bodies collide a contact point is reported but this (I think) is in the world co-ordinate system. My problem is I can't seem to convert the contact point to a usable co-ordinate on both of

the warning “'uniqueIdentifier' is deprecated” in project based on cocos2d-box2d

≡放荡痞女 提交于 2019-12-10 18:49:22
问题 I create a new project based on cocos2d-box2d, and there are always 4 warning in two files, one is CLScoreServerPost.m, the code has warning is following [self addValue:[[UIDevice currentDevice] uniqueIdentifier] key:@"cc_device_id"]; and another is CLScoreServerRequest.m, the code has warning is following device = [[UIDevice currentDevice] uniqueIdentifier]; both of them show the same warning: 'uniqueIdentifier' is deprecated so what should I do? many thanks 回答1: You can use for example

Library andenginephysicsbox2dextension not found

我怕爱的太早我们不能终老 提交于 2019-12-10 11:58:56
问题 I have used the andengine.jar file in our application. I have run the physicsexample. But it shows error Library andenginephysicsbox2dextension not found. Is there any solution to remove this error. 回答1: I believe you should not use andengine.jar. Instead fetch the source code from repository. See this thread on AndEngine forums: http://www.andengine.org/forums/announces/andengine-gles2-pre-release-on-december-23rd-t6097.html You will need to get AndEngine and the extensions you wish to use.

Can I change filter all the time in box2d?

烂漫一生 提交于 2019-12-10 11:58:35
问题 I know kill or add a b2body will crash when contacting. But if i only change the body filter ? if (box2dSubFixture) { b2Filter filter = box2dSubFixture->GetFilterData(); filter.maskBits = BOX2D_MaskBits_NONE; filter.categoryBits = BOX2D_CategoryBits_NONE; box2dSubFixture->SetFilterData(filter); } 来源: https://stackoverflow.com/questions/26082030/can-i-change-filter-all-the-time-in-box2d

Box2D AndEngine: app hangs out when creating Joints during ContactListener?

…衆ロ難τιáo~ 提交于 2019-12-10 11:33:00
问题 I am using Box2D in AndEngine (for Android). My purpose is to create a Force joint whenever 2 objects collide with each other. When I try to create a Mouse Joint between 2 objects (bodies) during ContactListner process. The application will hang for some time then exit, without any error, just a notification of threads ending. The Joint creating is OK when I call mEnvironment.CreateForceJoint(..) outside the ContactListener - somewhere while app is running in some physics.UpdateHandler().