Commit ada86753 authored by Master Q's avatar Master Q

模型替换

parent 0a527e6e
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"name": "UI" "name": "UI"
}, },
{ {
"keys": "luntai.gltf,qiche_V6.gltf,shamo_V10.gltf", "keys": "luntai.gltf,qiche_V6.gltf,shamo_V10.gltf,shamo_V14_L(1).gltf",
"name": "gltf" "name": "gltf"
}, },
{ {
......
...@@ -497,7 +497,7 @@ export class CarScene extends PerspectiveScene { ...@@ -497,7 +497,7 @@ export class CarScene extends PerspectiveScene {
scene: THREE.Scene, scene: THREE.Scene,
} }
const ins: GltfModel = RES.getRes('shamo_V10.gltf') const ins: GltfModel = RES.getRes('shamo_V14_L(1).gltf')
let terrainMesh: THREE.Mesh let terrainMesh: THREE.Mesh
this.scene.add(ins.scene) this.scene.add(ins.scene)
...@@ -515,8 +515,9 @@ export class CarScene extends PerspectiveScene { ...@@ -515,8 +515,9 @@ export class CarScene extends PerspectiveScene {
)) ))
} else if (obj.name === 'shamo' && (obj as THREE.Mesh).isMesh) { } else if (obj.name === 'shamo' && (obj as THREE.Mesh).isMesh) {
terrainMesh = obj as THREE.Mesh terrainMesh = obj as THREE.Mesh
} else if (obj.name === 'shitou') { } else if (obj.name.startsWith('shitou')) {
obj.castShadow = true obj.castShadow = true
obj.receiveShadow = true
this.ammoPhysicWorld.addRigidBodyWithMeshObj(createRigidBodyByThreeObject( this.ammoPhysicWorld.addRigidBodyWithMeshObj(createRigidBodyByThreeObject(
obj as THREE.Mesh, obj as THREE.Mesh,
{ {
...@@ -572,17 +573,17 @@ export class CarScene extends PerspectiveScene { ...@@ -572,17 +573,17 @@ export class CarScene extends PerspectiveScene {
console.log(this.dirLight) console.log(this.dirLight)
this.dirLight && (this.dirLight.target = vehicleIns.chassisMesh) this.dirLight && (this.dirLight.target = vehicleIns.chassisMesh)
const planeGeometry = new THREE.BoxGeometry(100, 2, 100) // const planeGeometry = new THREE.BoxGeometry(100, 2, 100)
// planeGeometry.rotateX( - Math.PI / 2 ); // 这里加了旋转矩阵 物理世界 记得要转换一下 // // planeGeometry.rotateX( - Math.PI / 2 ); // 这里加了旋转矩阵 物理世界 记得要转换一下
const planeMesh = new THREE.Mesh(planeGeometry, new THREE.MeshPhongMaterial({ // const planeMesh = new THREE.Mesh(planeGeometry, new THREE.MeshPhongMaterial({
color: 0xffffff, // color: 0xffffff,
side: THREE.DoubleSide, // side: THREE.DoubleSide,
// wireframe: true // // wireframe: true
})) // }))
planeMesh.position.y = -1 // planeMesh.position.y = -1
// @ts-ignore // // @ts-ignore
planeMesh.material = terrainMesh.material // planeMesh.material = terrainMesh.material
this.scene.add(planeMesh) // this.scene.add(planeMesh)
// this.ammoPhysicWorld.addMesh(planeMesh, { // this.ammoPhysicWorld.addMesh(planeMesh, {
...@@ -832,7 +833,8 @@ export class CarScene extends PerspectiveScene { ...@@ -832,7 +833,8 @@ export class CarScene extends PerspectiveScene {
set currDistance(v: number) { set currDistance(v: number) {
this._currDistance = v this._currDistance = v
GDispather.dispatchEvent('distanceUpdateSync', { GDispather.dispatchEvent('distanceUpdateSync', {
distance: v distance: v,
circleNo: this.rotateNum.toFixed(2)
}) })
} }
...@@ -910,7 +912,8 @@ export class CarScene extends PerspectiveScene { ...@@ -910,7 +912,8 @@ export class CarScene extends PerspectiveScene {
onGameSubmit(n: number) { onGameSubmit(n: number) {
console.log('当前分数:', Math.abs(n), '圈数:', (this.rotateNum / Math.PI / 2).toFixed(2)) console.log('当前分数:', Math.abs(n), '圈数:', (this.rotateNum / Math.PI / 2).toFixed(2))
GDispather.dispatchEvent('distanceUpdate', { GDispather.dispatchEvent('distanceUpdate', {
distance: Math.abs(n) distance: Math.abs(n),
circleNo: this.rotateNum.toFixed(2)
}) })
if (this.UICtn.querySelector('.tips')) { if (this.UICtn.querySelector('.tips')) {
this.UICtn.querySelector('.tips').textContent = '当前提交分数:' + Math.abs(n).toFixed(2) this.UICtn.querySelector('.tips').textContent = '当前提交分数:' + Math.abs(n).toFixed(2)
......
...@@ -5,7 +5,7 @@ export const ResJson = { ...@@ -5,7 +5,7 @@ export const ResJson = {
"name": "UI" "name": "UI"
}, },
{ {
"keys": "luntai.gltf,qiche_V6.gltf,shamo_V10.gltf", "keys": "luntai.gltf,qiche_V6.gltf,shamo_V10.gltf,shamo_V14_L(1).gltf",
"name": "gltf" "name": "gltf"
}, },
{ {
...@@ -14,5 +14,5 @@ export const ResJson = { ...@@ -14,5 +14,5 @@ export const ResJson = {
} }
], ],
// eslint-disable-next-line // eslint-disable-next-line
"path": "https://yun.duiba.com.cn/db_games/activity/template/1663753225/resource/" "path": "https://yun.duiba.com.cn/db_games/activity/template/1664156899/resource/"
} }
\ No newline at end of file
...@@ -6,12 +6,14 @@ type GDType = { ...@@ -6,12 +6,14 @@ type GDType = {
isPortrait: boolean // 是否是竖屏 isPortrait: boolean // 是否是竖屏
}, },
'distanceUpdate': { 'distanceUpdate': {
distance: number distance: number,
circleNo: string
}, },
'resetVehicle': any, 'resetVehicle': any,
'changeCameraPos': any, 'changeCameraPos': any,
'distanceUpdateSync': { 'distanceUpdateSync': {
distance: number distance: number,
circleNo: string
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment