I've been having a bit of trouble manipulating bones at runtime. Currently, I'm using this code in my render loop:
//Update position player.update(x, y); //Get torso bone and set angle SpriterBone torso = player.getBoneByName("Torso"); Vector2 mouseLoc = new Vector2(Gdx.input.getX(), Gdx.input.getY()); Vector2 playerLoc = entity.getComponent(Physics.class).getLocation().toCameraCoords(); float angle = MathUtils.atan2(mouseLoc.y - playerLoc.y, mouseLoc.x - playerLoc.x) * MathUtils.radDeg; torso.setAngle(angle); //Render player spriteBatch.begin(); spriterDrawer.draw(player); spriteBatch.end();
However, the torso's angle never updates from it's original angle (which is 90 degrees). The player is running an idle animation while I try to do this, but that animation never actually changes the torso in any way, so I'm not sure why the angle won't update. Anyone know what I'm doing wrong?