box2d

How can I prevent a ball from sticking to walls in Box2D?

二次信任 提交于 2019-12-04 02:58:51
问题 I'm experimenting with box2d. I seem to have a problem people describe as sticky walls I have a ball and a paddle I'm using all the basic recommended scales I could find, 10m world, 1m ball The ball has the following properties: shape: circle (.5f radius) size: 1.0f density: 1.0f restitution: 1.0f friction: 0.0f The paddle used to move the ball is 1.5m, it has the following properties: shape: circle (.75f radius) size: 1.5f density: 10.0f restitution: 0.1f friction: 0.0f As you see the

Libgdx game crashes on Android

三世轮回 提交于 2019-12-03 23:04:08
I made a game using libgdx and it runs fine on both desktop and android before. I'm not sure if its because I started using box2d physics engine and liquidfun particles,what basically happens is that when I click play on my game it start loading then after loading it should go to the gameScreen, but it crashes then says "Unfortunately, myGame has stopped". error message: E/AndroidRuntime: FATAL EXCEPTION: GLThread 3764 Process: com.nivekbryan.puffypuff, PID: 8416 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/badlogic/gdx/physics/box2d/World; I followed this setup tutorial on how

LIBGDX: What is a “viewport”?

自闭症网瘾萝莉.ら 提交于 2019-12-03 18:30:31
问题 This post is related to an earlier post of wanting to learn how to properly render in between LIBGDX and Box2D. I had to understand viewport well before I could proceed. After much code/post readings, I felt the meaning of "viewport" was "the rectangle opening of a lens of the camera that views LIBGDX's Game world, where I can move it about the world to view what I want". But, after more reading, I seemed to be nowhere near the actual meaning. I've read the LIBGDX wiki, and read in the OpenGL

Sprite Kit failing assertion: (typeA == b2_dynamicBody || typeB == b2_dynamicBody)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 18:10:27
问题 This was asked earlier, but the original asker didn't need to change the dynamic property so he answered his own question by unasking it. I'm using Sprite Kit in iOS7 and I'd like to be able to change an SKPhysicsBody's dynamic property at runtime. Originally I was changing that in my touchesBegan: method. Someone in the Apple Dev forum suggested moving the change to the didSimulatePhysics: method but that didn't help either. This code causes the error: -(void)touchesBegan:(NSSet *)touches

Box2dweb - Collision Contact Point

霸气de小男生 提交于 2019-12-03 12:50:42
I use box2dweb. I am trying to develop a game. At some point I need to find out the contact point between a "Circle" and "Box". All I know is it can be done using b2ContactListener. We can receive contact data by implementing b2ContactListener using Post-Solve Event. Please help! You are on the right track there are various events you can hook into with the b2ContactListener: var b2Listener = Box2D.Dynamics.b2ContactListener; //Add listeners for contact var listener = new b2Listener; listener.BeginContact = function(contact) { //console.log(contact.GetFixtureA().GetBody().GetUserData()); }

用CMake代替makefile进行跨平台交叉编译

不羁的心 提交于 2019-12-03 11:07:04
 在开始介绍如何使用CMake编译跨平台的静态库之前,先讲讲我在没有使用CMake之前所趟过的坑。因为很多开源的程序,比如png,都是自带编译脚本的。我们可以使用下列脚本来进行编译: 1 2 3 ./configure --prefix=/xxx/xx --enable- static = YES make make install   相信手动在类Unix系统上面编译过开源程序的同学对上面的命令肯定非常熟悉。更悲惨的是,有些开源库是不提供configure配置文件的,只有一个Makefile或者Makefile.gcc。我的体会是,Makefile是一个很复杂的东西,没有一定的积累我们是看不懂的,更别说去修改它了。而本文的CMake可以更傻瓜更简单地达到我们的目的,你不需要理会复杂的makefile语法。Just follow me!    如果不配置编译器和一些编译、链接参数,这样的操作,最后编译出来的静态库只能在本系统上面被链接使用。比如你在mac上面运行上面的命令,编译出来的静态库就只能给mac程序链接使用。如果在Linux上面运行上述命令,则也只能给Linux上面的程序所链接使用。如果我们想要在Mac上面编译出ios和android的静态库,就必须要用到交叉编译。   要进行交叉编译,一般来说要指定目标编译平台的编译器,通常是指定一个CC环境变量,根据编译的是c库还是c+

How to apply constant force on a Box2D body?

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am making a Box2d game for the iPhone. I need to apply a force on a body which represents my main character. The body is actually a rectangle on top of a circle connected using a revolute joint. I am using this as the skeleton for my character who is supposed to be running through the game(any suggestions or feedback on this too would be appreciated). I need a force to be applied continuously so that it keeps him moving. What would be the best way to do this? I am currently applying linear velocity inside the tick method. _world

When to use ShapeRenderer, Mesh + SpriteBatch, Box2D and Scene2D in Libgdx?

◇◆丶佛笑我妖孽 提交于 2019-12-03 06:04:41
I'm new in Android Game Development and after I started with libgdx ShapeRenderer and did a little more search, I became confused if I started with the right foot. So, what I really would like to know is when should I use ShapeRenderer, Mesh + SpriteBatch, Box2D and Scene2D. P.T. LibGDX has quite a lot of (mostly orthogonal) APIs for rendering. I'm still learning my way around many of them, but I can give an overview of the different parts. ShapeRenderer lets you quickly and easily put basic flat-colored polygons and lines on the screen. Its not particularly efficient (it uploads a lot of

How to compile Box2D in Linux?

匿名 (未验证) 提交于 2019-12-03 01:27:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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://github.com/erincatto/Box2D.git ) Running cmake ..

Emscripten Bindings: How to create an accessible C/C++ array from Javascript?

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using box2d and attempting to create a chain shape. In order to create a chain shape or polygon shape I must pass an array of vectors in order to specify the geometry. I do not see any documentation to help me accomplish this, and the notes about bindings here don't go into any detail about arrays. How can I construct an array? 回答1: I have solved this problem by using these (as yet undocumented) emscripten features. Note that I am accessing the functions and values (like ALLOC_STACK and wrapPointer ) out of the Box2D object simply