首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
CS 135编程讲解、辅导web,HTML程序语言、web编程辅导 辅导Python编程|辅导Database
项目预算:
开发周期:
发布时间:
要求地区:
CS 135: Assignment 3: Fun with WebXR
In this assignment, you will gain experience in basic WebXR development in a web browser.
The lab is due in 2 weeks. This is the final lab; for the remaining lab sessions this quarter,
please use the time to work on your final projects.
Due date
Tuesday lab: Dec. 1, 2020 @ 11:59PM
Thursday lab: Dec. 3, 2020 @ 11:59PM
Important Notes:
1. Read all submission instructions carefully, and submit all required documents.
2. The WebXR Documentation
(https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API) and samples
(https://immersive-web.github.io/webxr-samples/) are good sources of
information/examples.
3. Check Slack for any bugs, updates, or important information for this programming
assignment.
Part 1: Setup
In this lab, you will be experimenting with WebXR. WebXR provides APIs to render VR/AR
content from a browser, using WebGL under the hood. WebXR allows access to VR/AR input
controllers, if you have them, but for this lab, we will be using a hardware emulator and work
entirely in the browser.
To do this, you will need to install a few things:
● A recent version of Google Chrome (79+ should be enough, tested on 86). Once you
have done this, you can visit the WebXR sample page
, and you should see a green
checkmark at the top showing that your browser supports WebXR.
● WebXR API emulator to emulate VR hardware:
jmkafnnje/>
● Your favorite web server. The easiest way is probably to run a local web server in your
browser using the “Web Server for Chrome” browser extension:
1
pcbhemlocgigb/>
Now save and extract the lab files (http://www.cs.ucr.edu/~jiasi/webxr_lab.zip) onto your local
web server. If you’re using “Web Server for Chrome”, configure the extension to host the lab
files folder.
When you open “index.html” (or whatever localhost Web Server for Chrome is set to), you
should see a scene with 3 cubes. Click “Enter VR” on the right button to see the view from each
eye.
Next open up the WebXR emulator from Chrome menu > More Tools > Developer Tools >
WebXR tab. You should have a display similar to that shown below (you may wish to re-arrange
the layout):
2
There are several important parts of the screen:
● Top third of the screen: The WebXR application.
● Middle third of the screen: The emulated VR hardware. Please select “Oculus Quest”
in the drop-down menu for this lab. Play around with the headset and controllers to
rotate and translate them (first click = translation controls, second click = rotation
controls). On the right, you can see the position and rotation of the headset and
controllers. There are “Select button” and “Squeeze button” controls for each of the
controllers.
● Bottom third of the screen: The console where you can view debug messages.
Play around with the default app to get familiar with it. The default behavior is:
● Select: When you press and de-press the “Select button” while interacting with a cube ,
its size and color should change.
● Squeeze: When you press, move the controller, and de-press the “Squeeze button”
while interacting with a cube, the cube should follow the controller’s position and also
change color and size. There may be a slight change in the cube’s position when you
first press the button; that is normal.
Great, now you’re all set up! Let’s move on to the fun part!
3
Part 2
You will mainly modify the index.html file for this lab. Open it up and get familiar with the
Javascript content. There are comments sprinkled throughout to help you understand. The
WebXR documentation linked in “Important Notes” above can also help.
One thing you may wish to know is that each controller has a ray emanating from it, pointing in a
straight line. This ray has both an origin and a direction in world space, and is already visualized
for you in the default app. For more information, see the documentation.
Example of a ray emanating from a controller
For debugging, you can use commands like “console.log("variable name " +
variable);” to print things into the WebXR console.
A) The default behavior of the app is that once the “Squeeze button” is de-pressed, the cube
goes back to its original position. Modify the code so that the cube stays at its current position
when the button is de-pressed. In other words, you can now drag and drop the cubes anywhere
you want in the scene.
Hint: Modify the onSqueezeEnd function and comment out the unnecessary lines.
B) Next, modify the code so that if the “select button” did not result in a cube changing color/size
(i.e., the hit test failed), then a new cube is created somewhere along the raycast from the
controller, in a color of your choosing. In other words, you can create new cubes at arbitrary
locations in the scene.
Hints: Add the necessary code to the onSelectStart function to create the new box. There is
an addBox helper function that may be handy. You can get an idea from onXRFrame on how to
get the origin and direction of the targetRayPose emanating from the controller.
4
Example: new red cubes created surrounding the center green cube.
C) Finally, modify the code so that when any two cubes are within 0.25 m of each other, they
1
both change color to white. For example, if I grab one cube using the “squeeze button” and drag
it on top of another cube, they should both turn white instantly. A cube should keep its white
color even if it moves away. If the “select” button is pushed on a white cube, a new random
color is selected. This should work for both the original cubes and the new cubes you created.
Hints: Add the necessary code to the onXRFrame function to detect the intersection and change
the color. There are some useful vector manipulation helper functions (e.g., length) in
js/third-party/gl-matrix/src/gl-matrix/vec3.js. The boxes array contains a list of the
current cubes in the scene. onSelect and onSqueeze have examples of how to change the box
color.
Example: The three cubes in the middle intersected with each other, so they turned white.
1 As long as the cubes’ “position” attributes are within 0.25 m, you can trigger the color change. You do
NOT need to do anything fancier, for example determining if the cube faces are within 0.25 m of each
other.
5
Grading Rubric
Submission Instructions
1. Create a zip file containing the following items:
a. The index.html file you modified for this lab.
b. A README.txt file containing any special instructions or notes you think are
relevant for evaluating your assignment.
2. Name the file by separating NetIDs with underscores- _cs135vr_HW3.zip. EXAMPLE: If
steve1 and anna2 worked together, the file should be called
steve1_anna2_cs135vr_HW3.zip
3. Only one team member should submit the zip.
Materials from The Immersive Web Community Group
is gratefully acknowledged.
6
Name Points Description
Part 1
Setup 0 Download and install necessary browser and browser
extensions, test basic WebXR app. No points.
Part 2
Cube positions 10 Cubes remain where you put them after “squeeze button”
is depressed
New cube 10 A new cube is created along the controller’s raycast if
“select button” does not interact with an existing cube
Cube intersection 10 Intersection of two cubes within 0.25 m detected
Color change 5 Cubes turn white upon intersection
Total 35
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写math 1151, autumn 2024 w...
2024-11-14
代做comp4336/9336 mobile dat...
2024-11-14
代做eesa01 lab 2: weather an...
2024-11-14
代写comp1521 - 24t3 assignme...
2024-11-14
代写nbs8020 - dissertation s...
2024-11-14
代做fin b377f technical anal...
2024-11-14
代做ceic6714 mini design pro...
2024-11-14
代做introduction to computer...
2024-11-14
代做cs 353, fall 2024 introd...
2024-11-14
代做phy254 problem set #3 fa...
2024-11-14
代写n1569 financial risk man...
2024-11-14
代写csci-ua.0202 lab 3: enco...
2024-11-14
代写econ2226: chinese econom...
2024-11-14
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!