libgdx

not proper collision in box2d

流过昼夜 提交于 2019-12-02 01:15:05
I am developing a game in which the user have to hit a high speed ball. To hit the ball I have joined a rectangular body with the actor using revolute joint and enabled its motor, to rotate it with a specified speed(motor speed). Now everything is perfect but sometime when ball`s velocity is high , it is bypassing the rectagular body. Using collision listner i found that collision is happening but ball is not getting reflected after collision. As this is happening only when ball is on a high speed, is it bcoz of density of bodies that are colliding . Or its the motor of revolute joint that is

loading regions of textureatlas in libgdx loads the entire file

时光毁灭记忆、已成空白 提交于 2019-12-02 00:57:10
问题 I managed to pack a textureatlas with images i have and it works properly in that it creates the .pack file and the .png file. The issue is when i load the texture atlas and try to assign AtlasRegions. it loads the entire atlas instead of only the image i want. here is a mockup code i used to test it. @Override public void create() { camera = new OrthographicCamera(800, 480); batch = new SpriteBatch(); test = new TextureAtlas(Gdx.files.internal("polytest.png")); sprite = test.findRegion("hero

Touch code only working at center of screen in my ball game using libgdx

冷暖自知 提交于 2019-12-01 23:47:58
My score does not increment after I touch the ball. It increments only when I touch the ball and its near the center of my screen. When my ball only moves in x axis keeping y constant the touch works fine. But when both are incremented the score increases only when touched at the center. @Override public void render () { batch.begin(); Gdx.gl.glClearColor(1,1,1,1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.draw(ball,xposi,yposi,100,100); if(gameState==1) { if (Gdx.input.justTouched()) { tmp = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0); textureBounds = new Rectangle(xposi, yposi,

LibGDX Saving textures to avoid context loss

雨燕双飞 提交于 2019-12-01 22:42:23
I have a texture in my LibGDX based Android app that is created procedurally through FrameBuffers that I need to preserve through context loss, and it seems that the only efficient way to do this is to simply save the data, whether as a full image or raw data, out, and load it back in when the time comes. I'm struggling to find any way to achieve this though, as every route I've taken has lead to complete failure in one way or another. I've searched around quite a bit, but nothing I've come across has worked out. I am mostly just looking for a hint into the right direction, rather than the

Libgdx How to rotate a 3D model on multiple axes with phone orientation

末鹿安然 提交于 2019-12-01 22:42:05
问题 I'm trying to rotate a 3D model on multiple axes at once using the phone's accelerometers. When I do this, I use setToRotation() however, this only does one axis at a time. For example: ModelInstance modelInstance = instances.first(); //ROLL modelInstance.transform.setToRotation(Vector3.Z, phoneAccel.y*9); //PITCH modelInstance.transform.setToRotation(Vector3.X, phoneAccel.z*9); The phone is in forced-landscape mode. I get the instance of the model I want to rotate. I set the Vector3

Adding libgdx to an Android Native Application

二次信任 提交于 2019-12-01 21:43:42
I have a simple kids app which teaches things such as colors, numbers, etc... which I am currently developing. It uses what I would consider "standard android java programming (Single Xml/java class)." I also have a simple game with a Dinosaur that jumps over letters using libgdx. My question is, I would like to have the game as part of the "overall" app. I would like to know if it is even possible to add a libgdx game to an android native application. I tried adding the appropriate files to my app, but this caused a compile error, could someone point me to a place where I could find help on

Getting java.net.MalformedURLException in MonoDeveloper

扶醉桌前 提交于 2019-12-01 21:24:53
Hey I am new to MonoDeveloper. I am trying to port libgdx code to iOS platform. My Libgdx code runs perfectly on desktop & Android phone. But when i run it on iPhone simulator with MonoDeveloper its giving me this error: Unhandled Exception: 0 iosgame [ERROR] FATAL UNHANDLED EXCEPTION: java.net.MalformedURLException: unknown protocol: file. 0x000e8932 mono_handle_exception_internal_first_pass + 3058 1 iosgame 0x000ea012 mono_handle_exception_internal + 1602 2 iosgame 0x000eab5f mono_handle_exception + 47 3 iosgame 0x0012dcb2 mono_x86_throw_exception + 306 4 ??? 0x0b73df8f 0x0 + 192143247 at

libgdx not using correct JAVA_HOME path

泪湿孤枕 提交于 2019-12-01 20:46:02
问题 I know there are plenty of questions on JAVA_HOME and I've certainly worked through it before. I've been setting up and running java code for years. It's my understanding that libgdx needs a path to a jdk bin, rather than a jre bin. When I tried to create a little test file, I received the following error: ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jre7\bin The invalid directory points to a jre bin, so I downloaded a jdk and added its path to my environment

LibGDX Path (CatmullRomSpline) Constant Speed

只谈情不闲聊 提交于 2019-12-01 20:40:15
问题 I’m trying to achieve constant speed on a path using the LibGDX CatmullRomSpline and I’m having problems getting it to work. I’ve tried researching on this topic a lot including reading the LibGDX wiki, but their explanation for achieving constant speed doesn’t really make sense and I wasn’t able to get their method to work. https://github.com/libgdx/libgdx/wiki/Path-interface-&-Splines In my case, the derivative values are very large (in the hundreds) so when dividing a number between 0-1 by

libgdx not using correct JAVA_HOME path

▼魔方 西西 提交于 2019-12-01 20:17:37
I know there are plenty of questions on JAVA_HOME and I've certainly worked through it before. I've been setting up and running java code for years. It's my understanding that libgdx needs a path to a jdk bin, rather than a jre bin. When I tried to create a little test file, I received the following error: ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jre7\bin The invalid directory points to a jre bin, so I downloaded a jdk and added its path to my environment variables, separated by a semicolon. C:\Program Files\Java\jdk1.7.0_40\bin;C:\Program Files\Java\jre7\bin but