Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
entrega-coches-igev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jonschi
entrega-coches-igev
Commits
27065b9e
Commit
27065b9e
authored
Mar 18, 2022
by
jonschi
Browse files
Options
Downloads
Patches
Plain Diff
add some comments to threejs script
parent
6d067307
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
threejs-car/dist/bundle.c2faa1a5e6ef15d01030.js.map
+1
-1
1 addition, 1 deletion
threejs-car/dist/bundle.c2faa1a5e6ef15d01030.js.map
threejs-car/src/script.js
+7
-0
7 additions, 0 deletions
threejs-car/src/script.js
with
8 additions
and
1 deletion
threejs-car/dist/bundle.c2faa1a5e6ef15d01030.js.map
+
1
−
1
View file @
27065b9e
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
threejs-car/src/script.js
+
7
−
0
View file @
27065b9e
...
...
@@ -24,12 +24,14 @@ const carFlatGeometry = new THREE.BoxGeometry(6,0.5,3)
// Materials
// Create a material for the tire that is black and uses a tire texture
const
tireMaterial
=
new
THREE
.
MeshStandardMaterial
()
tireMaterial
.
metalness
=
0.5
tireMaterial
.
roughness
=
0.4
tireMaterial
.
normalMap
=
tireTexture
tireMaterial
.
color
=
new
THREE
.
Color
(
0x888888
)
// Create a material for the Car that is green, metallic and uses a metal texture
const
carMaterial
=
new
THREE
.
MeshStandardMaterial
()
carMaterial
.
metalness
=
0.5
carMaterial
.
roughness
=
0.2
...
...
@@ -43,25 +45,30 @@ const carHeightMesh = new THREE.Mesh(carHeightGeometry, carMaterial)
carHeightMesh
.
name
=
"
Car High Mesh
"
scene
.
add
(
carHeightMesh
)
// Add the flat part of the car as a child to the root mesh
const
carFlatMesh
=
new
THREE
.
Mesh
(
carFlatGeometry
,
carMaterial
)
carFlatMesh
.
name
=
'
Car Flat Mesh
'
carHeightMesh
.
add
(
carFlatMesh
)
// Add the first tire to the root mesh
const
tireMesh1
=
new
THREE
.
Mesh
(
tireGeometry
,
tireMaterial
)
tireMesh1
.
name
=
'
Tire 1 Mesh
'
tireMesh1
.
position
.
set
(
-
2
,
-
1.2
,
1
)
carHeightMesh
.
add
(
tireMesh1
)
// Add the second tire to the root mesh
const
tireMesh2
=
new
THREE
.
Mesh
(
tireGeometry
,
tireMaterial
)
tireMesh2
.
name
=
'
Tire 2 Mesh
'
tireMesh2
.
position
.
set
(
-
2
,
-
1.2
,
-
1
)
carHeightMesh
.
add
(
tireMesh2
)
// Add the third tire to the root mesh
const
tireMesh3
=
new
THREE
.
Mesh
(
tireGeometry
,
tireMaterial
)
tireMesh3
.
name
=
'
Tire 3 Mesh
'
tireMesh3
.
position
.
set
(
2
,
-
1.2
,
-
1
)
carHeightMesh
.
add
(
tireMesh3
)
// Add the fourth tire to the root mesh
const
tireMesh4
=
new
THREE
.
Mesh
(
tireGeometry
,
tireMaterial
)
tireMesh4
.
name
=
'
Tire 4 Mesh
'
tireMesh4
.
position
.
set
(
2
,
-
1.2
,
1
)
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment