jbox2d

Using Intellij + Maven to import libraries: Cannot resolve symbol

回眸只為那壹抹淺笑 提交于 2020-01-11 06:03:07
问题 I have imported a library (JBox2D) using Maven in IntelliJ 13, for use in an android project. Maven didn't give me any error messages, so I assume the library was imported correctly. However, as soon as I try use a class from the library, I get "Cannot resolve symbol". IntelliJ doesn't offer the option of adding an import statement, as it normally does. How should I proceed? 回答1: Open the maven window and hit the reimport button (it's usually the first one on the toolbar). This will force

How to make two bodies stick after a collision?

倾然丶 夕夏残阳落幕 提交于 2020-01-02 05:40:14
问题 I am really stuck on this I can successfully detect a collision but I can't make the two bodies involved in the collision to stick. Here is my ContactListener world.setContactListener(listener); listener = new ContactListener() { @Override public void preSolve(Contact contact, Manifold oldManifold) { } @Override public void postSolve(Contact contact, ContactImpulse impulse) { } //called when two fixtures cease to touch @Override public void endContact(Contact contact) { Fixture fixtureA =

Slick2D and JBox2D. How to draw

谁说胖子不能爱 提交于 2019-12-17 10:24:18
问题 Before asking this i did A LOT of searching on the net. I just can't do it. It's a little hard for me to understand. So how do i draw the images at the right screen positions coresponding to bodies in world position? Thanx. If anyone else finds himslef in front of the same obstacle i posted a HOW TO, thanx to normalocity's good explanation. You can find it here: http://romeo.akademx.ro/2012/04/06/slick-and-box2d/ This is the render function: public void render(GameContainer container,

What is the 'f' used for in JBox-2d? [duplicate]

两盒软妹~` 提交于 2019-12-12 05:28:53
问题 This question already has answers here : What does suffix 'f' mean in Java code? (5 answers) Closed 5 years ago . It seems to be used in value declarations in the engine but the documentation of JBox-2D does not explain what this 'unit' is. Example: float x = 20.0f //<-- this 'f' FixtureDef fixDef = new FixtureDef(); fixDef.shape = shape; fixDef.density = 0.0f; //<-- this 'f' fixDef.friction = 0.9f; //<-- this 'f' What is it? If it is indeed a unit, what is it relative to? What benefit does

How do I get a body to bounce around the screen when there is gravity (Box2D/AndEngine)?

梦想与她 提交于 2019-12-11 16:22:01
问题 I've done quite a bit of searching and have found multiple suggestions for anti-gravity objects, but nothing seems to work just right. I have a physics world created with Earth's gravity. The user taps the screen and creates sprites/dynamic bodies. These then fall to the bottom of the screen due to the gravity. I have another sprite/body that is supposed to bounce around the screen, ignoring gravity and bouncing off the sprites that have been created. AndEngine's Box2D does not seem to have

How to make two bodies stick after a collision?

天大地大妈咪最大 提交于 2019-12-05 13:49:33
I am really stuck on this I can successfully detect a collision but I can't make the two bodies involved in the collision to stick. Here is my ContactListener world.setContactListener(listener); listener = new ContactListener() { @Override public void preSolve(Contact contact, Manifold oldManifold) { } @Override public void postSolve(Contact contact, ContactImpulse impulse) { } //called when two fixtures cease to touch @Override public void endContact(Contact contact) { Fixture fixtureA = contact.getFixtureA(); Fixture fixtureB = contact.getFixtureB(); Gdx.app.log("beginContact", "between" +

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

Android 如何实现气泡选择动画

China☆狼群 提交于 2019-11-29 18:33:54
跨平台用户体验统一正处于增长趋势:早些时候 iOS 和安卓有着不同的体验,但是最近在应用设计以及交互方面变得越来越接近。从安卓 Nougat 的底部导航到分屏特性,两个平台间有了许多相同之处。对设计师而言,我们可以将主流功能设计成两个平台一致(过去需要单独设计)。对开发者而言,这是一个提高、改进开发技巧的好机会。所以我们决定开发一个安卓气泡选择的组件库 —— 灵感来自于 苹果音乐 的气泡选择。 先说设计 我们的气泡选择动画是一个好的范例,它对不同的用户群体有着同样的吸引力。气泡以方便的 UI 元素汇总信息,通俗易懂并且视觉一致。它让界面对新手足够简单的同时还能吸引老司机的兴趣。 这种动画类型对丰富应用的内容由很大帮助,主要使用场景是:用户要从一系列选项中进行选择时的页面。例如,我们使用气泡来选择旅游应用中潜在目的地名字。气泡自由的浮动,当用户点击一个气泡时,选中的气泡会变大。这给用户很深刻的反馈并增强操作的直观感受。 组件使用白色主题,明亮的颜色和图片贯穿始终。此外,我决定试验渐变来增加深度和体积。渐变可能是主要的显示特征,会吸引新用户的注意。 气泡选择的渐变 我们允许开发者自定义所有的 UI 元素,所以我们的组件适合任意的应用。 再来看看开发者的挑战 当我决定实现这个动画时,我面临的第一个问题就是使用什么工具开发。我清楚知道绘制如此快速的动画在 Canvas 上绘制的效率是不够的

Libgdx Box2D pixel to meter conversion?

谁都会走 提交于 2019-11-28 00:30:24
When trying to program a game using Box2D, I ran into a problem with Box2D. I filled in pixel numbers for the lengths of the the textures and sprites to create a box around it. Everything was at the right place, but for some reason everything went very slowly. By looking on the internet I found out that if you didn't convert pixels to meters box2d might handle shapes as very large objects. this seemed to be a logical cause of everything moving slowly. I found similar questions on this site, but the answers didn't really seem to help out. in most of the cases the solution was to make methods to

Slick2D and JBox2D. How to draw

与世无争的帅哥 提交于 2019-11-27 11:30:29
Before asking this i did A LOT of searching on the net. I just can't do it. It's a little hard for me to understand. So how do i draw the images at the right screen positions coresponding to bodies in world position? Thanx. If anyone else finds himslef in front of the same obstacle i posted a HOW TO, thanx to normalocity's good explanation. You can find it here: http://romeo.akademx.ro/2012/04/06/slick-and-box2d/ This is the render function: public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException { g.setBackground(Color.white); g.pushTransform(); g