box2d

Libgdx Array<> how to get last item?

孤街浪徒 提交于 2019-12-25 16:56:40
问题 I want to change Y position of "bucket", when camera Y position is higher than "last created bucket" Y position: There is my code in "create()" method buckets = new Array<Bucket>(); for(int i=1;i<BUCKET_COUNT;i++){ buckets.add(new Bucket(world,(rand.nextInt((int)W)-45)/PPM,BUCKET_MARGIN*i/PPM)); } And I am doing like this in "render()" method: for(Bucket bucket : buckets){ if(cam.position.y > buckets.peek().getBody().getPosition().y){ bucket.repos(rand.nextInt((int)W)/PPM,buckets.size+BUCKET

Libgdx Box2d screen resolution

心不动则不痛 提交于 2019-12-25 13:16:34
问题 I've read a bit about what other people do to deal with different screen resolutions but I'm still very confused. If I have high resolution images and sprites that I want to use, should i work with a screen that like 1080x1920 and than create some methods that scale down for lower resolution screen? Or should I try to compress it down to some middle ground resolution and scale up and down as necessary? Also can anyone give me a good example of how to to the scaling for different resolutions?

Libgdx Box2d screen resolution

两盒软妹~` 提交于 2019-12-25 13:16:08
问题 I've read a bit about what other people do to deal with different screen resolutions but I'm still very confused. If I have high resolution images and sprites that I want to use, should i work with a screen that like 1080x1920 and than create some methods that scale down for lower resolution screen? Or should I try to compress it down to some middle ground resolution and scale up and down as necessary? Also can anyone give me a good example of how to to the scaling for different resolutions?

“Type or namespace Box2D could not be found” on Android (Xamarin/CocosSharp)

左心房为你撑大大i 提交于 2019-12-25 06:20:39
问题 Im building a simple game with Xamarin/Cocossharp in a Shared Project. I added some physics with Box2D and everything works well on WP8.1. I import Box2D and i access to the methods and class provided without problem on Windows Phone, but when i try to compile it for Android it says that the type or namespace "Box2D" could not be found. Intellisense doesn't shows any error... error output I'm new to game dev and also to VS2015 so it may be something simple but i dont understand what I'm

Box2d get Shape Points from rotated body

本秂侑毒 提交于 2019-12-25 05:22:36
问题 Im a little confused at the moment. If I get my Shape from my fixture in Box2d it returns me the points (with ->getVertices) related to the position of the body and angle. But shouldnt be there somewhere the stored data for the actual points of the shape ? To clear things up: I have a polygon Shape wich is rotated. And now i want to get all the Points of the Polygone where they are actual are. Is there a method i can use ? or do i have to calculate the transformation, wich wouldnt make much

cocos2dx+box2d:Object stops abruptly, tied two ropes

筅森魡賤 提交于 2019-12-25 05:09:27
问题 cocos2dx+box2d: Hello. I actually have a problem. I did a bit of rope and she behaves normally. But if the object tie two ropes, it somehow as it stops abruptly. Can anyone understand why this is happening and can help? I recorded a video with two ropes, which shows that the object sharply ostanavliaetsya. And the video with one rope, where all is well: One rope:http://youtu.be/Yh4x8qrgmgo Two rope: http://youtu.be/iRPVPLrC9ZQ Because of what the object may stop so abruptly? Add Rope:

AS3 Display list and box2d

一笑奈何 提交于 2019-12-25 04:48:10
问题 I have a function called "brick" inside a subclass called createBrick that extends from the sprite class, also I have a movie clip created in the library exported for runtime sharing called "Brick". For some odd reason when I run the code the brick is not showing up on the stage even though it does get created when I debug the code. here is the function public class createBrick extends Sprite { public function createBrick(_main:Main) { main = _main; var go:Brick = new Brick(); addChild(go);

How to restore b2Body state after collision?

半腔热情 提交于 2019-12-25 04:06:38
问题 I have 2 bodies. After they collide second body disappears , and the first one must go on it's move in the in the same way as before the collision. How it looks now: 1) I detect collision in contactListener::BeginContact(..) { }; 2) Save the second body to delete , and the first to restore it's velocity and angle. 3) -(void) update: (ccTime) dt { int32 velocityIterations = 8; int32 positionIterations = 1; _world->Step(dt, velocityIterations, positionIterations); ... world->DestroyBody

How to change size after it has been created

孤街浪徒 提交于 2019-12-25 03:26:19
问题 I am using java, libgdx, and box2d In main class I have created a player. I want to change shape.setAsBox to 100 in player class. So in other words I want to change shape.setAsBox after it has been created. I believe only way to do this is to delete fixture and recreate a new one with 100 size. How can I do this. public class main{ ... public main(){ //create player BodyDef bdef = new BodyDef(); Body body; FixtureDef fdef = new FixtureDef(); PolygonShape shape = new PolygonShape(); /***Body -

How to create a circle shape without solid polygon or non solid circle``

Deadly 提交于 2019-12-25 02:43:26
问题 I am developing a casino roulette game in box2d. As you know in this game a ball/dice will be in a circular spinning wheel. First I tried with b2circleShape but it didn't work. I mean that the ball is not sitting inside the circular shape. Then I tried with b2EdgeShape. But for the b2edgeShape I need to create as many vertices as I can to build a smooth circular surface. Is there anyway that I can create such circle shapes which are not polygons or which are not solid polygons? If have any