I want to set my arm of my player to point at my mouse in the window, this is my arm code for a fixture I couldn't find how to set it to rotate and point at the mouse
package com.mygdx.game.Sprites.player;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.mygdx.game.PlayScreen;
import com.mygdx.game.main;
@SuppressWarnings("unused")
public class LArm extends Sprite {
public LArm(PlayScreen screen){
setBounds(getX(), getY(), 3 / main.PPM, 8 / main.PPM);
setPosition(Player.b2body.getPosition().x, (float) Player.b2body.getPosition().y );
setRegion(new Texture(Gdx.files.internal("LArm.png")));
}
public void update(float dt) {
//setRotation(to the mouse);
if(Player.runningRight)
setPosition(Player.b2body.getPosition().x-1/main.PPM,Player.b2body.getPosition().y-8/main.PPM);
if(!Player.runningRight)
setPosition(Player.b2body.getPosition().x-2/main.PPM,Player.b2body.getPosition().y-8/main.PPM);
setRegion(new Texture(Gdx.files.internal("LArm.png")));
setOrigin((float)1.5 / main.PPM, 8 / main.PPM);
}
}