fixed offset

This commit is contained in:
Johannes Schmelz 2024-12-09 13:37:30 +01:00
parent 97619fe662
commit e337303408
3 changed files with 11 additions and 10 deletions

View File

@ -67,7 +67,7 @@ public class BoardAppState extends MonopolyAppState {
*/ */
private PopUpManager popUpManager;; private PopUpManager popUpManager;;
private Vector3f currentTarget = new Vector3f(-10f,0,-10f); private Vector3f currentTarget = new Vector3f(0f,0,0f);
/** /**
* Initializes the state by setting up the sky, lights, and other visual components. * Initializes the state by setting up the sky, lights, and other visual components.
@ -123,7 +123,7 @@ public class BoardAppState extends MonopolyAppState {
final float x = mx - cos; final float x = mx - cos;
final float y = my - sin; final float y = my - sin;
final Camera camera = getApp().getCamera(); final Camera camera = getApp().getCamera();
camera.setLocation(new Vector3f(0,30,0)); camera.setLocation(new Vector3f(30,20,0));
camera.lookAt(new Vector3f(getCurrentTarget()), camera.lookAt(new Vector3f(getCurrentTarget()),
Vector3f.UNIT_Y); Vector3f.UNIT_Y);
camera.update(); camera.update();

View File

@ -44,7 +44,7 @@ public class BobTheBuilder extends GameBoardSynchronizer {
// Setze die Rotation basierend auf der Feld-ID // Setze die Rotation basierend auf der Feld-ID
node.setLocalRotation(figure.getRot().toQuaternion()); node.setLocalRotation(figure.getRot().toQuaternion());
node.addControl(new FigureControl(spatial, figure, app)); node.addControl(new FigureControl(node, figure, app));
return node; return node;
} }

View File

@ -5,6 +5,7 @@ import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f; import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager; import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort; import com.jme3.renderer.ViewPort;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial; import com.jme3.scene.Spatial;
import com.jme3.scene.control.AbstractControl; import com.jme3.scene.control.AbstractControl;
@ -19,7 +20,7 @@ import java.util.Queue;
public class FigureControl extends AbstractControl implements GameEventListener { public class FigureControl extends AbstractControl implements GameEventListener {
private final Figure figure; private final Figure figure;
private final Spatial spatial; private final Node spatial;
private final MonopolyApp app; private final MonopolyApp app;
private Queue<Vector3f> path; // Path to follow private Queue<Vector3f> path; // Path to follow
private Vector3f currentTarget; private Vector3f currentTarget;
@ -29,7 +30,7 @@ public class FigureControl extends AbstractControl implements GameEventListener
private float delayElapsed = 0f; // Zeit, die seit dem Start der Verzögerung vergangen ist private float delayElapsed = 0f; // Zeit, die seit dem Start der Verzögerung vergangen ist
public FigureControl(Spatial spatial, Figure figure, MonopolyApp app) { public FigureControl(Node spatial, Figure figure, MonopolyApp app) {
super(); super();
this.figure = figure; this.figure = figure;
this.spatial = spatial; this.spatial = spatial;