diff options
| Commit | c38a0381653100ecff778d408adac7205ad4a39d (patch) | |
|---|---|---|
| Author | 2022-11-21 19:48:42 +0200 | |
| Committer | 2022-11-21 19:48:42 +0200 | |
| Files | 562bcb8db812b707dc029940bc7b97a54576b9e3 | |
| uni-projects-c38a0381653100ecff778d408adac7205ad4a39d.tar uni-projects-c38a0381653100ecff778d408adac7205ad4a39d.tar.gz uni-projects-c38a0381653100ecff778d408adac7205ad4a39d.zip | ||
| Parent | f1497db5420996ac02de878ad347c9cfbf25ff1d (diff) | |
[OKG/HWK2] Implemented a simple way of setting what the camera is looking at
1 files changed, 9 insertions, 2 deletions
| -rw-r--r-- | Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html | 11 |
diff --git a/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html b/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html index b363186..4c68d91 100644 --- a/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html +++ b/Year 2/Computer Graphics Fundamentals/Homework 2/mannequin.html @@ -43,8 +43,8 @@ var aspect = window.innerWidth/window.innerHeight;
var camera = new THREE.PerspectiveCamera( 30, aspect );
- camera.position.set( -300, 80, 100 );
- camera.lookAt( new THREE.Vector3(0, 50, -250) );
+ camera.position.set( 400, 50, 90 );
+ camera.lookAt( lookingDirectionVec(camera, [-1, 0, 0]) );
function onWindowResize(event)
{
@@ -183,6 +183,13 @@ object.children.forEach((child) => enableCastShadow(child));
}
+ function lookingDirectionVec(camera, vec) {
+ return new THREE.Vector3(
+ camera.position.x + vec[0],
+ camera.position.y + vec[1],
+ camera.position.z + vec[2]);
+ }
+
/*
* Функции, генериращи обекти
*/
|
