Initial Commit: 3D Project - 1 - Code - Before Render (0ob9k4vl76.js)
parent
5747bc69fd
commit
7653691908
|
@ -0,0 +1,41 @@
|
|||
var project = data;
|
||||
|
||||
if (!project.loaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only respond to before_render events for my parent project
|
||||
*/
|
||||
if (project !== this.getParentProject()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.initialized) {
|
||||
|
||||
/**
|
||||
* Set some initialization code here
|
||||
*/
|
||||
this.totalTime = 0;
|
||||
project.cameras[1].position.y = 10;
|
||||
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
if (project.applicationMode === R3.API.Project.APPLICATION_MODE_RUN) {
|
||||
|
||||
this.totalTime += project.clock.delta;
|
||||
|
||||
project.cameras[1].position.x = 15 * Math.sin(this.totalTime * 0.1);
|
||||
project.cameras[1].position.z = 15 * Math.cos(this.totalTime * 0.1);
|
||||
project.cameras[1].lookAt.x = 0;
|
||||
project.cameras[1].lookAt.y = 0;
|
||||
project.cameras[1].lookAt.z = 0;
|
||||
|
||||
project.cameras[1].updateInstance('position');
|
||||
project.cameras[1].updateInstance('lookAt');
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
//@ sourceURL=3d_project_1_code_before_render.js
|
Loading…
Reference in New Issue