-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
564 lines (492 loc) · 23 KB
/
index.html
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
<!DOCTYPE html>
<html>
<head>
<title>This Game Is Not a School Project.</title>
<!-- script src="https://unpkg.com/aframe"></script-->
<!--script src="https://unpkg.com/aframe-text-sprite"></script-->
</head>
<body>
<style>
/*css so that the game viewport doesn't bounce around when you touch the arrow keys*/
html, body, script {
padding: 0;
border: 0;
margin: 0;
}
</style>
<script type="module">
// const shortenings for easier typing
const f = false; const t = true;
//import the good shtuff
import * as THREE from './js/build/three.module.js';
import { OBJLoader2 } from './js/examples/jsm/loaders/OBJLoader2.js';
if (false) {
console.log("The world has ended. Please do not run this program, and instead take shelter.");
}
// creates a world to hold all the data
const scene = new THREE.Scene();
// make a camera!
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const X_AXIS = new THREE.Vector3(1, 0, 0); //whoops we forgot to use these declarations
const Y_AXIS = new THREE.Vector3(0, 1, 0); //
camera.position.y += 1; //camera init position
camera.position.z = 7; //
//for the delay before the camera tilts
let cameraBuildupR = 0;
let cameraBuildupL = 0;
//how long to wait before camera tilt
const CAMERATHRESHOLD = 20;
// renderer
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight); // renderer is size of the entire window
renderer.setClearColor(0x2E1C31, 1); //pretty purple bg uwu
document.body.appendChild(renderer.domElement); //hello DOM!
// an array to hold bounding boxes. shoulda renamed this
let staticBodies = [];
// keyboard input handler, takes inputs for arrow keys.
let upKey = f; let downKey = f; let rightKey = f; let leftKey = f; let qKey = f; let eKey = f; // what key is being pressedwhen?
//event listener babyy!
document.addEventListener('keydown', eventKeyDown);
function eventKeyDown(in_key) {
switch (in_key.code) {
case "ArrowUp":
case "KeyW":
upKey = t;
break;
case "ArrowDown":
case "KeyS":
downKey = t;
break;
case "ArrowRight":
case "KeyD":
rightKey = t;
break;
case "ArrowLeft":
case "KeyA":
leftKey = t;
break;
case "KeyQ":
qKey = t;
case "KeyE":
eKey = t;
}
}
//can't forget to release the key, too!
document.addEventListener('keyup', eventKeyUp);
function eventKeyUp(in_key) {
switch (in_key.code) {
case "ArrowUp":
case "KeyW":
upKey = f;
break;
case "ArrowDown":
case "KeyS":
downKey = f;
break;
case "ArrowRight":
case "KeyD":
rightKey = f;
break;
case "ArrowLeft":
case "KeyA":
leftKey = f;
break;
case "KeyQ":
qKey = f;
case "KeyE":
eKey = f;
}
}
//bounding box obj
class boundingBox {
constructor(in_V2max, in_V2min) {
//take in two points to generate a bounding box around.
this.max = in_V2max;
this.min = in_V2min;
}
//if two bounding boxes' bounds overlap on the x axis, return true.
collides_x(in_bB) {
let output = f;
if (this.max.x > in_bB.min.x && this.min.x < in_bB.max.x) {
output = t;
}
if (this.min.x < in_bB.max.x && this.max.x > in_bB.min.x) {
output = t;
}
return output;
}
//if two bounding boxes' bounds overlap on the y axis, return true.
collides_y(in_bB) {
let output = f;
if (this.max.y > in_bB.min.y && this.min.y < in_bB.max.y) {
output = t;
}
if (this.min.y < in_bB.max.y && this.max.y > in_bB.min.y) {
output = t;
}
return output;
}
//test both axes simultaneously
collides(in_bB) {
return (this.collides_x(in_bB) && this.collides_y(in_bB));
}
//update a bB's location by an offset
move(in_V2) {
this.max = this.max.add(in_V2);
this.min = this.min.add(in_V2);
}
//we should remove this funciton. it was meant to force a bB's location to whereever we want. didnt work out
forcemove(in_V2) {
this.max = in_V2;
this.min.x = in_V2.x * -1;
this.min.y = in_V2.y * -1;
}
//update a bB's location by a negative offset.
nmove(in_V2) {
let moveV2 = new THREE.Vector2(-in_V2.x, -in_V2.y)
this.move(moveV2)
}
//determine if two bBs will collide
will_collide(in_bB, in_V2) {
in_bB.move(in_V2);
if (this.collides(in_bB)) {
in_bB.nmove(in_V2);
return t;
} else {
in_bB.nmove(in_V2);
return f;
}
}
}
// image locations to reference
let IMG = {
brick: "assets/brick_1024.png", //0
wood: "assets/wood_1024.png", //1
grass: "assets/grass_top.png", //2
mc_grass: "assets/grass_side.png",
dirt: "assets/grass_bottom.png",
flesh: "assets/floomie_side.png",
purple: "assets/floomie_bottom.png",
red: "assets/floomie_top.png",
bench: "assets/bench.png",
char_1: "assets/character1.png",
char_2: "assets/character2.png",
char_3: "assets/character3.png",
char_4: "assets/character4.png",
tree_1: "assets/tree1.png",
tree_2: "assets/tree2.png",
shack: "assets/shack.png",
lamp: "assets/lamppost.png",
d_1: "assets/text1.png",
d_2: "assets/text2.png",
d_3: "assets/text3.png",
d_4: "assets/text4.png",
d_5: "assets/text5.png",
d_6: "assets/text6.png",
d_7: "assets/text7.png",
d_8: "assets/text8.png",
d_9: "assets/text9.png",
d_A: "assets/textA.png",
d_B: "assets/textB.png",
}
// define player
const player_texture = new THREE.TextureLoader().load( "assets/floomie_side_face.png" );
player_texture.wrapS = THREE.RepeatWrapping;
player_texture.wrapT = THREE.RepeatWrapping;
player_texture.repeat.set( 1, 1 );
//variables for the player!
const playerSize = new THREE.Vector2(1,1)
const playerGeometry = new THREE.BoxGeometry(playerSize.x, playerSize.y, 1);
const playerMaterial = new THREE.MeshPhongMaterial({ color: 0xffffff });
playerMaterial.map = player_texture;
const player = new THREE.Mesh(playerGeometry, playerMaterial);
let playerBoundingBox = new boundingBox(new THREE.Vector2(player.position.x + 1/2 * playerSize.x, player.position.y + 1/2 * playerSize.y), new THREE.Vector2(player.position.x - 1/2 * playerSize.x, player.position.y - 1/2 * playerSize.y));
scene.add(player);
const G = 0.015; // acceleration due to gravity
const V0_Y = 0.2; // initial velocity when jumping
const A_X = 0.02; // hz acceleration, when on a surface
const A_X_air = 0.01; // hz acceleration, when in mid air
const A_V_MAX = 0.2; // hz max velocity
const MU_X = 0.01; // hz deceleration
//objloader for the house!
const objLoader = new OBJLoader2();
const objMaterial = new THREE.MeshPhongMaterial({color:0xffffff});
const objTexture = new THREE.TextureLoader().load( "assets/wood_1024.png" );
objLoader.load('assets/houseyhouse.obj', (obj) => {
obj.rotation.y -= -1.9;
obj.position.x -= 0.5;
obj.position.z -= 3;
obj.position.y -= 1;
obj.traverse( function ( child ) {
if ( child.isMesh ) child.material.map = objTexture; //thank you angus for this
} );
scene.add(obj); //i dont really care abt adding an error condition
});
//object for any plane u wanna draw in the world! i was too lazy to support rotation
class staticPlane {
constructor(in_width, in_height, in_V3_position, in_texture) {
this.Width = in_width;
this.Height = in_height;
this.Geometry = new THREE.PlaneBufferGeometry(this.Width, this.Height);
this.Material = new THREE.MeshPhongMaterial({
color: 0xffffff,
transparent: true,
alphaTest: 0.5});
this.Texture = new THREE.TextureLoader().load(in_texture);
this.Texture.wrapS = THREE.RepeatWrapping;
this.Texture.wrapT = THREE.RepeatWrapping;
this.Texture.repeat.set(1, 1);
this.Material.map = this.Texture;
this.Material.side = THREE.DoubleSide;
this.Body = new THREE.Mesh(this.Geometry, this.Material);
this.Body.position.x += in_V3_position.x;
this.Body.position.y += in_V3_position.y;
this.Body.position.z += in_V3_position.z;
scene.add(this.Body);
}
}
//object for any rectangular prism you want to draw in the world
class staticBox {
constructor(in_V3_size, in_V3_position, in_texture) {
this.Size = in_V3_size;
this.Geometry = new THREE.BoxGeometry(this.Size.x, this.Size.y, this.Size.z);
this.Material = new THREE.MeshPhongMaterial({ color: 0xffffff });
this.Texture = new THREE.TextureLoader().load(in_texture);
this.Texture.wrapS = THREE.RepeatWrapping;
this.Texture.wrapT = THREE.RepeatWrapping;
this.Texture.repeat.set( this.Size.x, this.Size.y );
this.Material.map = this.Texture;
this.Body = new THREE.Mesh(this.Geometry, this.Material);
this.Body.position.x += in_V3_position.x;
this.Body.position.y += in_V3_position.y;
this.Body.position.z += in_V3_position.z;
//console.log(in_V3_position);
scene.add(this.Body);
}
}
//object for any rectangular prism u wanna draw.... with collision!
class platform extends staticBox { //only works for box geometry
constructor(in_V3_size, in_V3_position, in_texture) {
super(in_V3_size, in_V3_position, in_texture);
//make a bB that's appropriate to the box's bounds
this.BoundingBox = new boundingBox(new THREE.Vector2(this.Body.position.x + 1/2 * this.Size.x, this.Body.position.y + 1/2 * this.Size.y), new THREE.Vector2(this.Body.position.x - 1/2 * this.Size.x, this.Body.position.y - 1/2 * this.Size.y));
staticBodies.push(this.BoundingBox);
}
}
// things to draw in the world
let staticBoxes = [new staticBox(new THREE.Vector3(10,6,7), new THREE.Vector3(-3, -4, -4.5), IMG.grass),
new staticBox(new THREE.Vector3(10.5, 12.5, 5.5), new THREE.Vector3(-10, -4, -5), IMG.dirt),
new staticBox(new THREE.Vector3(500, 50, 0.1), new THREE.Vector3(250, -27.5, -1), IMG.dirt),
new staticBox(new THREE.Vector3(10, 10, 6), new THREE.Vector3(-2, -6.5, -3.5), IMG.dirt),
new staticBox(new THREE.Vector3(12, 10, 10), new THREE.Vector3(20, -7.5, -7.5), IMG.dirt),
new staticBox(new THREE.Vector3(20, 10, 10), new THREE.Vector3(5, -10.5, -9.5), IMG.dirt),
new staticBox(new THREE.Vector3(12, 1, 2), new THREE.Vector3(20, -2, -5), IMG.brick),
new staticBox(new THREE.Vector3(12, 0.1, 10), new THREE.Vector3(20, -2.5, -8), IMG.brick),
new staticBox(new THREE.Vector3(25, 10, 10), new THREE.Vector3(45, -5, -9.5), IMG.grass),
new staticBox(new THREE.Vector3(26, 10, 12), new THREE.Vector3(45, -6, -9.5), IMG.mc_grass),
new staticBox(new THREE.Vector3(28, 10, 14), new THREE.Vector3(45, -8, -9.5), IMG.grass),
new staticBox(new THREE.Vector3(20, 10, 10), new THREE.Vector3(80, -4.75, -10), IMG.grass),
new staticBox(new THREE.Vector3(20, 10, 10), new THREE.Vector3(75, -6.5, -9), IMG.grass),
new staticBox(new THREE.Vector3(20, 10, 10), new THREE.Vector3(69, -9.5, -6.5), IMG.dirt),
new staticBox(new THREE.Vector3(20, 10, 10), new THREE.Vector3(88, -2, -10), IMG.grass),
new staticBox(new THREE.Vector3(21, 10, 11), new THREE.Vector3(88, -3, -10), IMG.mc_grass),
new staticBox(new THREE.Vector3(22, 10, 12), new THREE.Vector3(88, -4, -10), IMG.dirt),
new staticBox(new THREE.Vector3(25, 10, 12), new THREE.Vector3(95, 0.5, -8), IMG.brick),
];
let staticPlanes = [new staticPlane(2, 3, new THREE.Vector3(-3,0.5,-1), IMG.lamp),
new staticPlane(2, 3, new THREE.Vector3(15,0,-5), IMG.lamp),
new staticPlane(4, 2, new THREE.Vector3(18,-0.5,-5), IMG.bench),
new staticPlane(1.5, 1.5, new THREE.Vector3(23, -0.25,-5), IMG.char_3),
new staticPlane(8, 4, new THREE.Vector3(38,2,-5), IMG.shack),
new staticPlane(2, 3, new THREE.Vector3(34,1,-5), IMG.tree_1),
new staticPlane(1.5, 1.5, new THREE.Vector3(43,0.75,-5), IMG.char_1),
new staticPlane(1.5, 1.5, new THREE.Vector3(46,0.75,-5), IMG.char_4),
new staticPlane(1.5, 1.5, new THREE.Vector3(75, 1,-6), IMG.char_2),
new staticPlane(1.5, 1.5, new THREE.Vector3(59, -2.25,-6), IMG.char_3),
new staticPlane(2, 3, new THREE.Vector3(-50,0.5,-1), IMG.tree_1),
new staticPlane(2, 3, new THREE.Vector3(-42,0,-1), IMG.tree_2),
new staticPlane(2, 3, new THREE.Vector3(-40,0.5,-1), IMG.tree_2),
new staticPlane(2, 3, new THREE.Vector3(-39,0,-1), IMG.tree_1),
new staticPlane(2, 3, new THREE.Vector3(-21,0.5,-1), IMG.tree_2),
new staticPlane(2, 3, new THREE.Vector3(-55,0.5,-1), IMG.tree_1),
new staticPlane(2, 3, new THREE.Vector3(-59,0,-1), IMG.tree_1),
];
let textplanes = [new staticPlane(5, 5, new THREE.Vector3(-2,2.5,-2), IMG.d_3),
new staticPlane(6, 6, new THREE.Vector3(23,1.5,-4), IMG.d_4),
new staticPlane(6, 6, new THREE.Vector3(46,3,-4.5), IMG.d_7),
new staticPlane(6,6, new THREE.Vector3(75, 2.5,-4), IMG.d_5),
new staticPlane(6,6, new THREE.Vector3(61, -0.5,-5), IMG.d_6),
new staticPlane(6,6, new THREE.Vector3(98, 8,-5), IMG.d_B),
new staticPlane(6,6, new THREE.Vector3(-111, 6,-5), IMG.d_2),
new staticPlane(6,6, new THREE.Vector3(-111, 4,-5), IMG.d_1),
new staticPlane(3,3, new THREE.Vector3(6, -2,1), IMG.d_A),
];
let platforms = [new platform(new THREE.Vector3(100,6,2), new THREE.Vector3(-65, -4, 0), IMG.grass),
new platform(new THREE.Vector3(10,6,2), new THREE.Vector3(0, -4, 0), IMG.brick),
new platform(new THREE.Vector3(5,6,2), new THREE.Vector3(10, -4, 0), IMG.brick),
new platform(new THREE.Vector3(10,12,5), new THREE.Vector3(-10, -3, -5), IMG.grass),
new platform(new THREE.Vector3(10,6,1.5), new THREE.Vector3(20, -4, 0), IMG.brick),
new platform(new THREE.Vector3(10,6,1.5), new THREE.Vector3(35, -4, 0), IMG.brick),
new platform(new THREE.Vector3(10,6,1.5), new THREE.Vector3(51.5, -4, 0), IMG.brick),
new platform(new THREE.Vector3(10.1,6,0.25), new THREE.Vector3(69.5, -4, 0), IMG.brick),
new platform(new THREE.Vector3(10,6,15), new THREE.Vector3(79.5, -4, -5), IMG.brick),
new platform(new THREE.Vector3(6,6,10), new THREE.Vector3(84.5, -0.5, -2.5), IMG.brick),
new platform(new THREE.Vector3(10,4,7), new THREE.Vector3(96.5, 3.5, -1.5), IMG.brick),
];
// lighting. im too tired to modularize this shit
const light_top = new THREE.PointLight( 0xF3A1AC, 0.1 );
light_top.position.set( 0, 50, 0 );
scene.add(light_top);
const light_front = new THREE.PointLight( 0xF3A1AC, 1.2); //light that follows the player
light_front.position.set( 0, 0, 4 );
scene.add(light_front);
const light_side = new THREE.PointLight( 0xffffff, 0.9);
light_side.position.set( -3, 2, 1.5);
scene.add(light_side);
const light_lamp = new THREE.PointLight( 0xffffff, 0.9);
light_lamp.position.set( -15, 2, 3);
scene.add(light_lamp);
const light_evil1 = new THREE.PointLight( 0xff0000, 0.5 );
light_evil1.position.set( 6.25, -9, 1);
scene.add(light_evil1);
const light_evil2 = new THREE.PointLight( 0xff0000, 0.5 );
light_evil2.position.set( 11.25, -9, 1);
scene.add(light_evil2);
const light_evil3 = new THREE.PointLight( 0xff0000, 0.5 );
light_evil3.position.set( 26.25, -9, 1);
scene.add(light_evil3);
const light_evil4 = new THREE.PointLight( 0xff0000, 0.5 );
light_evil4.position.set( 42.25, -9, 1);
scene.add(light_evil4);
const light_evil5 = new THREE.PointLight( 0xff0000, 0.5 );
light_evil5.position.set( 62.25, -9, 1);
scene.add(light_evil5);
const light_evil6 = new THREE.PointLight( 0xff0000, 0.5 );
light_evil6.position.set( 86.25, -7, 1);
scene.add(light_evil6);
const light_ambient = new THREE.AmbientLight( 0xCD6531, 0.4 ); // soft white light
scene.add( light_ambient );
let ds = new THREE.Vector2(0,0); // ds = delta of displacement //of course nishant had to use calculus jargon to describe velocity // i still f*cking hate math and will never not hate math
let is_on_floor = f; //is the player on the floor?
//all the other stuff
const init = function() {
//was gonna have an alert message but it broke the site rip
//window.alert("Welcome to the CubeZone! Use WASD or the Arrow Keys to move!");
}
const animate = function () {
requestAnimationFrame(animate);
// gravity
ds.y -= G;
is_on_floor = f;
for (let i = 0; i < staticBodies.length; i++) {
if (staticBodies[i].will_collide(playerBoundingBox, ds)) {
ds.y = 0;
is_on_floor = t;
}
}
// jump
if (upKey && is_on_floor) {
ds.y += V0_Y;
}
// horizontal movement! (all the math is done in 2d)
if (leftKey && rightKey) {
ds.x = ds.x;
} else if (leftKey && ds.x > -A_V_MAX) {
if (ds.y != 0) {
ds.x -= A_X_air; //move the velocity by our acceleration const, but move differently in air!!!
} else {
ds.x -= A_X; //move the velocity by our acceleration const
}
} else if (rightKey && ds.x < A_V_MAX) {
if (ds.y != 0) {
ds.x += A_X_air; //same thing, but change velocity positively!
} else {
ds.x += A_X; //
}
} else if (ds.x < A_X && ds.x > - A_X) { //if you're within a margin of the acceleration, just stop, we dont want any jittering bruh
ds.x = 0; //bro stop movin!!
} else if (ds.x > 0) {
ds.x -= MU_X; //slowww downnnn brooooooo
} else if (ds.x < 0) {
ds.x += MU_X;
}
//collision for all static bodies
for (let i = 0; i < staticBodies.length; i++) {
if (staticBodies[i].will_collide(playerBoundingBox, new THREE.Vector2(ds.x, G))) {
ds.x = 0; //stop!!
}
}
//determine if the player is within appropriate bounds to update the x coord of camera
if (ds.x > 0) {
if ((camera.position.x - player.position.x) < -1) { //left
camera.position.x += ds.x;
}
} else if (ds.x < 0) {
if ((camera.position.x - player.position.x) > 1) { //right
camera.position.x += ds.x;
}
}
// check for left movement
if (leftKey) {
cameraBuildupL++;
if(cameraBuildupL >= CAMERATHRESHOLD) if (camera.rotation.y < 0.2) camera.rotation.y += 0.02;
} else {
if (cameraBuildupL > 0) cameraBuildupL = 0;
if (camera.rotation.y > 0) camera.rotation.y -= 0.02;
}
// check for right movement
if (rightKey) {
cameraBuildupR++;
if (cameraBuildupR >= CAMERATHRESHOLD) if (camera.rotation.y > -0.2) camera.rotation.y -= 0.02;
} else {
if (cameraBuildupR > 0) cameraBuildupR = 0;
if (camera.rotation.y < 0) camera.rotation.y += 0.02;
}
//console.log(camera.position);
console.log(player.position);
if (player.position.y <= -8) {
//reset all vars if the player dies
camera.position.x = 0;
camera.position.y = 1;
camera.position.z = 7;
camera.rotation.x = 0;
camera.rotation.y = 0;
camera.rotation.z = 0;
player.position.x = 0;
player.position.y = 0;
player.position.z = 0
ds.x = 0;
ds.y = 0;
playerBoundingBox.forcemove(new THREE.Vector2(0.5, 0.5));
is_on_floor = f;
//location.reload();
}
//rotate that lil pink dude
staticPlanes[3].Body.rotation.y += 0.02;
staticPlanes[3].Body.rotation.z += 0.03;
//move the light with the player
light_front.position.x = player.position.x;
light_front.position.y = player.position.y;
light_front.position.z = player.position.z+1;
//update the camera, player and player's bounding box to follow each other
camera.position.y += ds.y;
camera.updateProjectionMatrix();
moveObject(player, ds);
playerBoundingBox.move(ds);
//render the scene!!
renderer.render(scene, camera);
};
init();
animate();
// OH MY GOD I DIDNT REALIZE THESE WERE PROGRAMMED IN,,, I COULDA BEEN USING THESE OH MY LORD,,,,,,,,,,
function moveObject(o, in_V2) {
o.position.x += in_V2.x;
o.position.y += in_V2.y;
}
function rotateObject(o, in_V2) {
o.rotation.x += in_V2.x;
o.rotation.y += in_V2.y;
}
</script>
</body>
</html>