contents are placed on inner faces of building, with visibles above surface and others below
This commit is contained in:
+44
-28
@@ -184,7 +184,7 @@ export default {
|
||||
// cam_controls: null,
|
||||
init_cam_pos: { x: 0, y: 10, z: 100 },
|
||||
raycaster: new THREE.Raycaster(),
|
||||
interactive_objects_names: ['Project', 'ContentBlock'],
|
||||
interactive_objects_names: ['Project', 'Content'],
|
||||
interactive_objects: [],
|
||||
light_opts: {
|
||||
castShadow: true
|
||||
@@ -286,34 +286,47 @@ export default {
|
||||
let cam = this.camera
|
||||
let camPos = { ...this.camera.position }
|
||||
if (intersects.length) {
|
||||
console.log('onDocMouseUp intersects', intersects)
|
||||
for (var i = 0; i < intersects.length; i++) {
|
||||
object = intersects[i].object
|
||||
vnode = object.userData.vnode
|
||||
vnode.isOpened = true
|
||||
// console.log('onDocMouseUp intersects', intersects)
|
||||
// for (var i = 0; i < intersects.length; i++) {
|
||||
object = intersects[0].object
|
||||
vnode = object.userData.vnode
|
||||
vnode.isOpened = true
|
||||
|
||||
// new TWEEN.Tween(this.controls.cam_target)
|
||||
// .to(object.position, 400)
|
||||
// .start()
|
||||
//
|
||||
toPos = { ...object.position }
|
||||
if (object.name === 'ContentBlock') {
|
||||
toPos.z += 1
|
||||
toPos = { ...object.position }
|
||||
if (object.name === 'Content') {
|
||||
// toPos.z += 1
|
||||
switch (vnode.face) {
|
||||
case 'left':
|
||||
toPos.x += 2
|
||||
break
|
||||
case 'back':
|
||||
toPos.z += 2
|
||||
break
|
||||
case 'right':
|
||||
toPos.x -= 2
|
||||
break
|
||||
case 'front':
|
||||
toPos.z -= 2
|
||||
break
|
||||
}
|
||||
// toPos.y = 5
|
||||
new TWEEN.Tween(camPos)
|
||||
.easing(TWEEN.Easing.Quadratic.InOut)
|
||||
.to(toPos, 3000)
|
||||
.onUpdate(function () {
|
||||
// console.log('tween update', this._object)
|
||||
cam.position.set(this._object.x, this._object.y, this._object.z)
|
||||
// camControls.update()
|
||||
})
|
||||
.start()
|
||||
|
||||
// console.log('tween', tween)
|
||||
break
|
||||
// TODO: we need to update lon and lat accordingly when chaging camera orientation
|
||||
// new TWEEN.Tween(this.controls.cam_target)
|
||||
// .to(object.position, 2000)
|
||||
// .start()
|
||||
}
|
||||
// toPos.y = 5
|
||||
new TWEEN.Tween(camPos)
|
||||
.easing(TWEEN.Easing.Quadratic.InOut)
|
||||
.to(toPos, 3000)
|
||||
.onUpdate(function () {
|
||||
// console.log('tween update', this._object)
|
||||
cam.position.set(this._object.x, this._object.y, this._object.z)
|
||||
})
|
||||
.start()
|
||||
|
||||
// console.log('tween', tween)
|
||||
// break
|
||||
// }
|
||||
} else {
|
||||
// new TWEEN.Tween(this.camera.position)
|
||||
// .to(this.init_cam_pos, 1000)
|
||||
@@ -329,13 +342,16 @@ export default {
|
||||
// if (this.controls.user_interact === false) {
|
||||
// this.controls.lon += 0.1
|
||||
// }
|
||||
// if (this.controls.user_interact) {
|
||||
this.controls.cam_target.x = 500 * Math.sin(this.controls.phi) * Math.cos(this.controls.theta)
|
||||
this.controls.cam_target.y = 500 * Math.cos(this.controls.phi)
|
||||
this.controls.cam_target.z = 500 * Math.sin(this.controls.phi) * Math.sin(this.controls.theta)
|
||||
// if (this.camera && this.controls.user_interact) {
|
||||
this.camera.lookAt(this.controls.cam_target)
|
||||
// }
|
||||
|
||||
if (this.camera) {
|
||||
this.camera.lookAt(this.controls.cam_target)
|
||||
}
|
||||
|
||||
// TWEENS
|
||||
TWEEN.update()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user