box2d

Box2D / OpenGL : one texture mapped on many vertices

╄→гoц情女王★ 提交于 2020-01-24 02:03:05
问题 I'm trying to do this kind of object with Box2D : Wobbly Picture using Box2D Building the grid with bodies and joints is not a problem, but I would like to use this matrix of points to warp my image. the problem is that I don't know how to "cut" my texture and map it on an OpenGL vertex array. I heard about u and v coordinates, but what about the texture cropping ? 回答1: Since you are asking how to connect textures, take a look into this modification of this hane lesson : // // This code was

android cocos2d-x 2.2 box2d setup

梦想的初衷 提交于 2020-01-24 01:02:07
问题 I have made a cross platform box2d cocos2d-x project and it works on ios and blackberry but I am not able to get it to work on android. I have looked at tutorials and all of them are from 2.15 and before. I added all the debug code in android.mk and I still get errors related anything to box2d saying it cannot be resolved LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := cocos2dcpp_shared LOCAL_MODULE_FILENAME := libcocos2dcpp LOCAL_SRC_FILES := hellocpp/main.cpp \ ../..

BodyEditorLoader - noSuchMethod

柔情痞子 提交于 2020-01-20 07:04:06
问题 So, I started using Physics Body Editor as an extension to libgdx . I also use Android Studio to compile my code, so I can run an app on a real device. But, unfortunately, as I create a new loader, like this: BodyEditorLoader loader = new BodyEditorLoader(Gdx.files.internal("tnkA.json")); logcat gives me the following error: java.lang.NoSuchMethodError: No virtual method parse(Ljava/lang/String;)Ljava/lang/Object; Clearly, something wrong with the Physics Body Editor . Is there any way to fix

Is there an upper limit on velocity when using box2d?

坚强是说给别人听的谎言 提交于 2020-01-19 15:40:53
问题 I'm using box2d for physics simulation. I'm moving a circle using arrow keys by applying impulse on the body when ever a key is pressed. Unfortunately, the circle moves excruciatingly slow and doesn't seem to accelerate like a true physical body is supposed to. My world's dimensions are 400x800 pixels. The radius of the circle body is 20f. According to this, the problem can be solved by scaling the circle radius down when creating it and scaling up after getting the body position during

how to use box2d for collision detection in cocos2d-x

一笑奈何 提交于 2020-01-17 08:30:32
问题 my two sprites are roll and hero. i want to detect their collision using box2d in cocos2d-x i have got both the sprites moving on the screen (roll automatically, hero manually). all i want to do is call the function intersection(); when the two sprites collide. (sprites are declared globally in the *.h file) #include "GameScene.h" #include "HomeScene.h" USING_NS_CC; CCScene* GameScene::scene() { // 'scene' is an autorelease object CCScene *scene = CCScene::node(); // 'layer' is an autorelease

Box2D: How to detect which side of a polygon gets collision

℡╲_俬逩灬. 提交于 2020-01-16 20:22:53
问题 A small rectangle is lobbed toward a larger rectangle. I want to know if it hits the large rectangle in "the side" or on "the top". I'd also like to detect if the smaller polygon comes to rest on its own side, top, or bottom. I'm going to imagine this will entail using GetAngle() on the body to detect how it is oriented, but I'd like to hear if there is a better way. Thanks 回答1: You could create your "object collided with" as multiple fixtures. Use a polygon or square shape for the main

Box2D: How to detect which side of a polygon gets collision

此生再无相见时 提交于 2020-01-16 20:21:51
问题 A small rectangle is lobbed toward a larger rectangle. I want to know if it hits the large rectangle in "the side" or on "the top". I'd also like to detect if the smaller polygon comes to rest on its own side, top, or bottom. I'm going to imagine this will entail using GetAngle() on the body to detect how it is oriented, but I'd like to hear if there is a better way. Thanks 回答1: You could create your "object collided with" as multiple fixtures. Use a polygon or square shape for the main

Can't Run html libgdx with libgdx-utils

五迷三道 提交于 2020-01-15 09:04:07
问题 Im trying to compile my libgdx game, its working for android and desktop, but not HTML GWT. Im using Intellij / Gradle for the project. I just added the libgdx-utils extension lib found here which seems to be causing the error: https://bitbucket.org/dermetfan/libgdx-utils/wiki/Dependency%20Instructions The error i get when attempting this gradle command ./gradlew html:dist is: :html:compileGwt Compiling module com.xx.xx.GdxDefinition Validating units: [ERROR] Errors in 'file:/xx/xx/xx/screens

Can't Run html libgdx with libgdx-utils

假如想象 提交于 2020-01-15 09:03:32
问题 Im trying to compile my libgdx game, its working for android and desktop, but not HTML GWT. Im using Intellij / Gradle for the project. I just added the libgdx-utils extension lib found here which seems to be causing the error: https://bitbucket.org/dermetfan/libgdx-utils/wiki/Dependency%20Instructions The error i get when attempting this gradle command ./gradlew html:dist is: :html:compileGwt Compiling module com.xx.xx.GdxDefinition Validating units: [ERROR] Errors in 'file:/xx/xx/xx/screens

Body moving without any force applied? (Box2d)

痞子三分冷 提交于 2020-01-15 08:31:38
问题 So I am making a game in box 2d. In one part I need a ball which has a constant bounce height. I set the ball's restitution to 1 and am applying no force on it whatsoever (except gravity of course). Now this ball, on every bounce, bounces a bit higher everytime till it goes out of the top edge of the screen. What is wrong with this code? public class Ball implements ApplicationListener { World world ; Box2DDebugRenderer debugRenderer; OrthographicCamera camera; static final float BOX_STEP=1