+18
-1
lines changedFilter options
+18
-1
lines changed Original file line number Diff line number Diff line change
@@ -359,6 +359,22 @@ class TransformComponent(x: Double, y: Double, angle: Double, scaleX: Double, sc
359
359
updateDirection()
360
360
}
361
361
362
+
private var boundLookAt: TransformComponent? = null
363
+
364
+
fun bindToLookAt3D(other: TransformComponent) {
365
+
boundLookAt = other
366
+
}
367
+
368
+
fun unbindToLookAt3D() {
369
+
boundLookAt = null
370
+
}
371
+
372
+
override fun onUpdate(tpf: Double) {
373
+
boundLookAt?.let {
374
+
lookAt(it.position3D)
375
+
}
376
+
}
377
+
362
378
/**
363
379
* Move forward on the XZ plane.
364
380
* No Y movement.
Original file line number Diff line number Diff line change
@@ -71,7 +71,6 @@ protected void initGame() {
71
71
.collidable()
72
72
.buildAndAttach();
73
73
74
-
// TODO: camera follow entity, which smoothly continuously calls "look at" entity?
75
74
var camera = getGameScene().getCamera3D();
76
75
camera.getTransform().xProperty().bind(e.xProperty());
77
76
camera.getTransform().yProperty().bind(e.yProperty().subtract(10));
Original file line number Diff line number Diff line change
@@ -56,6 +56,8 @@ class Camera3D {
56
56
57
57
fun update(tpf: Double) {
58
58
tpfMoveSpeed = tpf * moveSpeed
59
+
60
+
transform.onUpdate(tpf)
59
61
}
60
62
61
63
fun moveForward() {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4