forked from fenomas/noa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes
57 lines (40 loc) · 1.67 KB
/
notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
TODO: go through all BJS material handling and set checkOnlyOnce, markDirty, etc.
* Add a "player crossed a chunk border" event
camera and movement after latest changes:
rendering processors:
physics - set backtracked renderPositions from physics data
followsEntity - copy entity's renderPosition from followed target
mesh - move meshes to render positions
rendering function:
updateCamera
copy camera target pos/rot to cameraHolder mesh
tween camera position (inside camera holder) towards capped position
check if camera is now inside solid block
if so, check obstructions
set cam offset and cap distance
move camera to cap
acutal render
TODO
make physics engine handle bodies that don't collide with terrain
make terrain component aware of this
Later: need to rework camera to just be a free camera that looksAt() stuff?
.. in order to have a follow camera with a target offset from player mesh
Movement
entity movement component
heading, runspeed, stopspeed, jumpHeight, etc.
input receiving component processor
set player entity's heading from camera direction
set isRunning, isJumping, etc. from inputs
mob AI processor (plays same role as input, but from AI)
set mob entity heading, isRunning, etc. based on AI rules
movement processor
apply forces in direction of heading
handle world collisions, friction, autostep, etc.
on RENDER
update mesh positions to body.position + velocity/dt
Function injection:
window._ct = 0
var q = function(x,y,z) { this.x=x, this.y=y, this.z=z; window._ct++ }
q.prototype = BABYLON.Vector3.prototype
for (var s in BABYLON.Vector3) { q[s] = BABYLON.Vector3[s] }
BABYLON.Vector3 = q