libgdx

How to render 3D object within a Libgdx Actor?

梦想与她 提交于 2019-12-12 05:16:43
问题 Most of the Libgdx tutorials I found show how to add 2D elements in a 3D world, but I would like to know how to the the opposite, adding 3D elements in a 2D Stage. I tried adding a background image to the Stage , then adding to the Stage an Actor that renders the model batch and the 3D instances in its draw() method. But instead, the image isn't drawn and part of the 3D object is hidden. SimpleGame class public class SimpleGame extends ApplicationAdapter { Stage stage; @Override public void

adMob new AdRequest() unrecognized by eclipse

不问归期 提交于 2019-12-12 05:04:42
问题 I am trying to add ad to my simply game. I' ve followed instructions from here: [url]https://github.com/libgdx/libgdx/wiki/Admob-in-libgdx[/url] . My AndroidLauncher looks like this : package com.redHoodie.android; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.RelativeLayout; import com.badlogic.gdx.backends.android.AndroidApplication; import com.google.ads.AdSize; import com.google.android.gms.ads

How is it possible to pause an action of an actor in LibGDX?

╄→尐↘猪︶ㄣ 提交于 2019-12-12 05:03:59
问题 I added the following action to my actor: this.addAction(sequence(delay(0.5f), alpha(1, 2), delay(2), alpha(0, 2))); Is there an easy way to pause this animation and then continue it when a button is clicked? 回答1: If your actor is only running action, I suggest to stop calling the act() method of the actor. Extend Actor to set a switch if needed. public void act(){ if(mUpdateAnimation){ this.act(delta) } } 回答2: Although the above answer is accepted, but when I tried the above solution, the

libgdx Fixed point after camera.rotateAround

自作多情 提交于 2019-12-12 05:03:56
问题 Good night friends. I'm having trouble drawing a fixed point on the screen when the screen is rotated. I used the method "rotateAround" from the position of the player. It seems to me. I have to rotate this fixed point also from the position of the player. I use this stretch learned here in stackoverflow. public void rotate(Vector3 position, Vector3 centerPoint){ this.cosTemp = MathUtils.cosDeg(this.anguloAtual); this.senTemp = MathUtils.sinDeg(this.anguloAtual); this.xTemp = centerPoint.x +

Why does my player move off the screen when I set the libGDX camera's position to the players x and y?

你离开我真会死。 提交于 2019-12-12 04:53:35
问题 for the past few days i have been tinkering around with moving the player with just one camera and having the camera follow the player's x and y. When i searched this up all i found was to move the player and set the camera's x and y to that. But i am having a problem, my player does not stay in the middle of the screen and it is really anoying. If anyone could hep me that would be great. Here is the code. in the create; cam = new OrthographicCamera(); cam.setToOrtho(false, Main.WIDTH, Main

Sprite not on position

你说的曾经没有我的故事 提交于 2019-12-12 04:47:36
问题 my sprites are not on position on diffrent screen sizes. What i have to do? My headline actor looks like: package actors; public class Headline extends Actor{ public static final int HEADLINE_POS_X = 450; public static final int HEADLINE_POS_Y = 200; private final TextureRegion textureRegion; private Rectangle textureRegionBounds; private OrthographicCamera cam; public Headline(TextureRegion textureRegion,OrthographicCamera cam) { this.textureRegion = textureRegion; this.cam = cam; Vector3

How to rotate android device camera preview(libgdx)

余生长醉 提交于 2019-12-12 04:44:18
问题 I'm using libgdx to make an application and I need to use the camera so I followed this tutorial and all my camera feed is rotated 90 degrees but they are being drawn as if they weren't. Unfortunately that means the preview is totally distorted and is very hard to use. I won't post my code here unless snippets are asked for because I copy-pasted the code from the tutorial into my game.. The only change I recall making was as follows. I changed the original surfaceCreated() method in

libgdx actor touchHandling issue

十年热恋 提交于 2019-12-12 04:44:05
问题 I have posted this question before but it seems that I am heading nowhere even though I did receive help from many people. Therefore I have done a small experiment. I have created a test project just to test out the LibGdx touch handling. This touchTester project somehow replicates my problem. Attached (attachment removed) please find the entire project source code (zipped file). The upCounter in following code should only return 1 since it should only be needed to run once. // upCounter is =

Loading Screen Libgdx Assetmanager

夙愿已清 提交于 2019-12-12 04:42:06
问题 Trying to create a loading screen, I have a Assets class and a LoadingScreen class which is called immediately from: this.setScreen(new LoadingScreen(this)); At loading screen I have this: public class LoadingScreen implements Screen{ final Game1 game; Sprite LdScreen; OrthographicCamera camera; public LoadingScreen(Game1 gam){ game=gam; camera = new OrthographicCamera(); camera.setToOrtho(false, 1920, 1080); } public void show() { Texture LdscreenTexture = new Texture(Gdx.files.internal(

Detect whether a specific part of body collided with another body in box2d

只谈情不闲聊 提交于 2019-12-12 04:37:38
问题 Kindly suggest some explanation or code regarding how can i detect collision between a specific part of one body with another body in box2d with libgdx.I am able to detect simple collision between two bodies using Contact Listener as mentioned hereBut I also want to check which part of bodies are ovelapping . Thanks, 回答1: The ContactListener provides you with Contact as a callback parameter. Those contacts will tell you which Fixtures did collide via contact.getFixtureA() and contact