libgdx

RayCasting in Libgdx 3d

牧云@^-^@ 提交于 2019-11-28 08:28:10
问题 Alright so I've been trying for quite some time too Raycast in libgdx for 3d collision detection based on where im looking.. But I've drawn a blank and doesn't seem to be any documentation anywhere. Would someone be kind enough to send me in the right direction? 回答1: It is actually really easy with libgdx to achieve what you are trying to do. The following is what I'm using to do a ray test and find the closest collision object that my ray would hit. Let's assume it is located in a class

Can't load libgdx desktop app on mac osx

雨燕双飞 提交于 2019-11-28 08:23:26
问题 I have been developing a simple game using libgdx on my Windows 7 PC. Recently I bought a macbook pro (mountain lion). I downloaded and installed JRE 7 and eclipse, then cloned and imported the project. However though there are no errors in the code when I run the desktop version I the JVM loads and quickly dies. The error I get in the console is as follows: JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM _NSJVMLoadLibrary: NSAddLibrary failed for /libjawt.dylib JavaVM FATAL:

Java Timer in GWT

别说谁变了你拦得住时间么 提交于 2019-11-28 08:15:04
问题 I'm trying to have a Java Timer in my EntryPoint: Timer timer = new Timer(); timer.schedule( new TimerTask() { public void run() { //some code } } , 5000); But when trying to compile this I got: No source code is available for type java.util.Timer ; did you forget to inherit a required module? What can I do to fix this error? 回答1: If you're using Libgdx, you can use the libgdx Timer infrastructure to schedule work to run in the future: Timer t = new Timer(); t.scheduleTask(new Timer.Task() {

why game is running slow in libgdx?

六月ゝ 毕业季﹏ 提交于 2019-11-28 07:53:06
I am making racing game in Libgdx.My game apk size is 9.92 mb and I am using four texture packer of total size is 9.92 Mb. My game is running on desktop but its run on android device very slow. What is reason behind it? Kumar Saurabh There are few loopholes which we neglect while programming. Desktop processors are way more powerful so the game may run smoothly on Desktop but may slow on mobile Device. Here are some key notes which you should follow for optimum game flow: No I/O operations in render method. Avoid creating Objects in Render Method. Objects must be reused (for instance if your

Google game services sign in issue (fails first attempt, successful second)

心不动则不痛 提交于 2019-11-28 07:42:54
问题 Currently trying to connect my game (that uses libgdx) to Google Game Services to enable leaderboard/achievements etc and seeing some strange behaviour. Problem When I first tap on "Sign in", it displays the dialog to choose your google account, then play services permission circles dialog, then the big loading circle. After a while, it displays a dialog with the following error Unknown issue with Google Play services If I tap 'Ok' to dismiss that error dialog, then tap on the "Sign in"

How do I force eclipse to update the apk on my hardware device with each build?

谁说我不能喝 提交于 2019-11-28 07:24:00
问题 If I change some code, save, and Run, it runs the last version of the program, not what I just saved. The only way I can make it update is if I Clean the project, Build the project, and then Run the project. Is there some way to avoid this tedium? 回答1: I spent some time create two dummy projects (one Android and one Java) and have a play with it, and finally come up with a workaround which is not used very often but able to solve your requirements. First, I will explain your question a bit

Rotate ModelInstance at specific point

本小妞迷上赌 提交于 2019-11-28 06:52:28
问题 How can i rotate ModelInstance at specific point( for example center of cube or corner of cube) ModelInstance inst; inst.transform.setToTranslation(cone.getX(),cone.getY(),cone.getZ()) .rotate(Vector3.Y,cone.getTiltOnY()).rotate(Vector3.X,cone.getTiltOnX()).rotate(Vector3.X,90); In my scenario i trying to rotate cone at its peek , but i rotate it in the middle. How i can set cone at coordinates as above, but rotate it at its peek. I need to do something like that : Gdx.gl10.glPushMatrix();

LibGDX: Android SpriteBatch not drawing

余生长醉 提交于 2019-11-28 06:36:35
问题 I'm having a hard time getting a spriteBatch to render in LibGDX. It shows when I run it for the desktop, but not on Android. I sprite I'm trying to render is the star background. Desktop: http://i.stack.imgur.com/6a4m5.png Android: http://i.stack.imgur.com/mOvo2.png Here's my code: @Override public void render(float delta) { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); Gdx.gl.glClearColor(0, 0, 0, 1); update(delta); spriteBatchBack.begin(); sprite.draw(spriteBatchBack

LibGDX not using Android asset folder

戏子无情 提交于 2019-11-28 06:12:03
问题 I am having a problem with a libGDX project reading the assets folder when compiling the Android or IOS build. While trying to access a file in the assets folder under the android module, I always seem to get a FileNotFoundException in IOS or Android, but not when running it on the Desktop. My desktop config points the android asset directory like it should. When executing the following code : public void readGameMap() throws IOException { readGameMap("gameMap.txt"); } public void readGameMap

libgdx drawing arc curve

ε祈祈猫儿з 提交于 2019-11-28 05:51:34
问题 The arc function of libgdx instead of drawing a arc draws a pie segment (ie. has 2 lines connecting to the arc's origin) shapeRenderer.begin(ShapeType.Line); shapeRenderer.arc(x, y, radius, 30, 120); shapeRenderer.end(); Is there a solution to this problem so that libgdx can draw an arc curve similar to the html5 canvas arc function? 回答1: Reading the source code, this seems built-in behavior: /** Draws an arc using {@link ShapeType#Line} or {@link ShapeType#Filled}. */ public void arc (float