Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
ThreeJsLesson
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
钱根
ThreeJsLesson
Commits
ada86753
Commit
ada86753
authored
Sep 26, 2022
by
Master Q
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模型替换
parent
0a527e6e
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22852 additions
and
22 deletions
+22852
-22
output.js
output.js
+1
-1
output.js.map
output.js.map
+1
-1
shamo_V14_L(1).gltf
resource/gltf/shamo_V14_L(1).gltf
+22825
-0
res.json
resource/res.json
+1
-1
index.ts
src/CarScene/index.ts
+18
-15
ResJson.ts
src/ResJson.ts
+2
-2
message.ts
src/message.ts
+4
-2
No files found.
output.js
View file @
ada86753
This diff is collapsed.
Click to expand it.
output.js.map
View file @
ada86753
This diff is collapsed.
Click to expand it.
resource/gltf/shamo_V14_L(1).gltf
0 → 100644
View file @
ada86753
This diff is collapsed.
Click to expand it.
resource/res.json
View file @
ada86753
...
@@ -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"
},
},
{
{
...
...
src/CarScene/index.ts
View file @
ada86753
...
@@ -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_V1
0
.gltf'
)
const
ins
:
GltfModel
=
RES
.
getRes
(
'shamo_V1
4_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
)
...
...
src/ResJson.ts
View file @
ada86753
...
@@ -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/166
3753225
/resource/"
"path"
:
"https://yun.duiba.com.cn/db_games/activity/template/166
4156899
/resource/"
}
}
\ No newline at end of file
src/message.ts
View file @
ada86753
...
@@ -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
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment