@eturnity/eturnity_3d 6.34.2 → 6.34.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_3d",
3
3
  "private": false,
4
- "version": "6.34.2",
4
+ "version": "6.34.3",
5
5
  "main": "dist/main.js",
6
6
  "scripts": {
7
7
  "dev": "vue-cli-service serve --skip-plugins @vue/cli-plugin-eslint",
@@ -10,8 +10,7 @@
10
10
  <script>
11
11
  import { mapActions, mapState, mapGetters, mapMutations } from 'vuex'
12
12
  import * as THREE from 'three'
13
- import { addVector, multiplyVector } from '@eturnity/eturnity_maths'
14
- import { updateComputedGeometryPolygon } from '@eturnity/eturnity_maths'
13
+ import { addVector, multiplyVector,updateComputedGeometryPolygon, normalizeVector } from '@eturnity/eturnity_maths'
15
14
 
16
15
  import threeMixin from '../helper/threeMixin'
17
16
  import materialMixin from '../helper/materialMixin'
@@ -154,14 +153,13 @@ export default {
154
153
  geometry.boundingSphere.center.z
155
154
  ]
156
155
  let objectRadius = geometry.boundingSphere.radius
156
+
157
157
  distance =
158
- 5 + objectRadius / Math.sin(((this.camera.fov / 2) * Math.PI) / 180)
159
- //_sphere.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );
158
+ 5+(objectRadius) / (Math.sin(((this.camera.fov / 2) * Math.PI) / 180))
160
159
  }
161
160
 
162
161
  polygonRef = updateComputedGeometryPolygon(polygonRef)
163
162
  const targetVector = polygonRef.meanPoint
164
- //const target=[targetVector.x/1000,targetVector.y/1000,targetVector.z/1000]
165
163
  let cameraMoveVector = { x: 0, y: 0, z: 0 }
166
164
  let flatRoof =
167
165
  polygonRef.normalVector.x == 0 && polygonRef.normalVector.y == 0
@@ -193,20 +191,22 @@ export default {
193
191
  this.orthographicCamera.updateProjectionMatrix()
194
192
  } else {
195
193
  //street view
196
- const horizontalVector = { ...polygonRef.normalVector, z: 0 }
194
+ let horizontalVector = { ...polygonRef.normalVector, z: 0 }
195
+
197
196
  if (horizontalVector.x == 0 && horizontalVector.y == 0) {
198
197
  //if flat roof=> go south
199
198
  horizontalVector.y = 1
200
199
  }
201
- let distanceCoefficient = 2
202
- if(flatRoof){
203
- distanceCoefficient = 1.5
204
- }
205
- cameraMoveVector = multiplyVector(distance * 1000 * distanceCoefficient, horizontalVector)
200
+ horizontalVector=normalizeVector(horizontalVector)
201
+ // let distanceCoefficient = 2
202
+ // if(flatRoof){
203
+ // distanceCoefficient = 1.5
204
+ // }
205
+ cameraMoveVector = multiplyVector(distance * 1000 , horizontalVector)
206
206
  }
207
207
 
208
208
  const positionVector = addVector(polygonRef.meanPoint, cameraMoveVector)
209
- if (flatRoof) positionVector.z += 2000
209
+ positionVector.z += 1000
210
210
  const position = [
211
211
  positionVector.x / 1000,
212
212
  positionVector.y / 1000 - 1,