Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OrigamiSimulator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Amanda Ghassaei
OrigamiSimulator
Commits
b7523b21
Commit
b7523b21
authored
Oct 4, 2017
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
debugging
parent
b43aec70
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
js/VRInterface.js
+18
-6
18 additions, 6 deletions
js/VRInterface.js
js/main.js
+3
-3
3 additions, 3 deletions
js/main.js
with
21 additions
and
9 deletions
js/VRInterface.js
+
18
−
6
View file @
b7523b21
...
...
@@ -44,7 +44,7 @@ function initViveInterface(globals){
position
:
new
THREE
.
Vector3
(
0
,
1.6
,
0
)
};
dat
.
GUIVR
.
en
ableMouse
(
camera
);
dat
.
GUIVR
.
dis
ableMouse
();
var
gui
=
dat
.
GUIVR
.
create
(
'
Settings
'
);
gui
.
position
.
set
(
0.2
,
0.8
,
-
1
);
gui
.
rotation
.
set
(
Math
.
PI
/
-
6
,
0
,
0
);
...
...
@@ -176,6 +176,7 @@ function initViveInterface(globals){
renderer
.
vr
.
enabled
=
globals
.
vrEnabled
;
if
(
globals
.
vrEnabled
)
{
dat
.
GUIVR
.
enableMouse
(
camera
);
globals
.
threeView
.
modelWrapper
.
scale
.
set
(
variables
.
scale
,
variables
.
scale
,
variables
.
scale
);
globals
.
threeView
.
modelWrapper
.
position
.
copy
(
variables
.
position
);
$link
.
html
(
"
EXIT VR
"
);
...
...
@@ -183,6 +184,7 @@ function initViveInterface(globals){
renderer
.
vr
.
standing
=
true
;
globals
.
threeView
.
setBackgroundColor
(
"
000000
"
);
}
else
{
dat
.
GUIVR
.
disableMouse
();
globals
.
model
.
reset
();
// globals.threeView.onWindowResize();
globals
.
threeView
.
resetCamera
();
...
...
@@ -231,7 +233,6 @@ function initViveInterface(globals){
var
position
=
controllers
[
i
].
position
.
clone
();
position
.
applyMatrix4
(
renderer
.
vr
.
getStandingMatrix
());
tMatrix
.
identity
().
extractRotation
(
controllers
[
i
].
matrixWorld
);
tDirection
.
set
(
0
,
0
,
-
1
).
applyMatrix4
(
tMatrix
).
normalize
();
position
.
add
(
tDirection
.
clone
().
multiplyScalar
(
0.05
));
...
...
@@ -242,16 +243,19 @@ function initViveInterface(globals){
nodes
[
i
].
setFixed
(
true
);
globals
.
fixedHasChanged
=
true
;
}
position
.
sub
(
variables
.
position
);
position
.
multiplyScalar
(
1
/
variables
.
scale
);
position
=
transformToMeshCoords
(
position
);
nodes
[
i
].
moveManually
(
position
);
globals
.
nodePositionHasChanged
=
true
;
continue
;
}
// position = transformToMeshCoords(position);
//todo get position and mesh in same reference frame
var
cast
=
new
THREE
.
Raycaster
(
position
,
tDirection
,
-
0.1
,
0.2
);
var
cast
=
new
THREE
.
Raycaster
(
position
,
tDirection
,
0
,
1
);
var
intersects
=
cast
.
intersectObjects
(
globals
.
model
.
getMesh
(),
false
);
if
(
intersects
.
length
>
0
){
var
intersection
=
intersects
[
0
];
...
...
@@ -269,7 +273,7 @@ function initViveInterface(globals){
var
_dist
=
(
transformToGlobalCoords
(
vertices
[
j
].
clone
()).
sub
(
point
)).
lengthSq
();
if
(
_dist
<
dist
){
dist
=
_dist
;
if
(
j
==
1
)
nodeIndex
=
face
.
b
;
if
(
j
<
2
)
nodeIndex
=
face
.
b
;
else
nodeIndex
=
face
.
c
;
}
}
...
...
@@ -277,7 +281,11 @@ function initViveInterface(globals){
nodes
[
i
]
=
nodesArray
[
nodeIndex
];
object3D
.
position
.
copy
(
transformToGlobalCoords
(
nodes
[
i
].
getPosition
().
clone
()));
object3D
.
visible
=
true
;
}
else
nodes
[
i
]
=
null
;
controllers
[
i
].
userData
.
mesh
.
material
.
color
.
setHex
(
0x888888
);
}
else
{
controllers
[
i
].
userData
.
mesh
.
material
.
color
.
setHex
(
0xff0000
);
nodes
[
i
]
=
null
;
}
}
else
{
console
.
warn
(
"
bad controller
"
);
...
...
@@ -291,6 +299,10 @@ function initViveInterface(globals){
position
.
add
(
variables
.
position
);
return
position
;
}
function
transformToMeshCoords
(
position
){
position
.
multiplyScalar
(
1
/
variables
.
scale
);
return
position
;
}
return
{
render
:
render
...
...
This diff is collapsed.
Click to expand it.
js/main.js
+
3
−
3
View file @
b7523b21
...
...
@@ -4,9 +4,9 @@
globals
=
{};
function
setCookie
(
c_name
,
value
,
exdays
){
var
exdate
=
new
Date
();
exdate
.
setDate
(
exdate
.
getDate
()
+
exdays
);
var
c_value
=
escape
(
value
)
+
((
exdays
==
null
)
?
""
:
"
; expires=
"
+
exdate
.
toUTCString
());
document
.
cookie
=
c_name
+
"
=
"
+
c_value
;}
function
getCookie
(
c_name
){
var
c_value
=
document
.
cookie
;
var
c_start
=
c_value
.
indexOf
(
"
"
+
c_name
+
"
=
"
);
if
(
c_start
==
-
1
){
c_start
=
c_value
.
indexOf
(
c_name
+
"
=
"
);}
if
(
c_start
==
-
1
){
c_value
=
null
;}
else
{
c_start
=
c_value
.
indexOf
(
"
=
"
,
c_start
)
+
1
;
var
c_end
=
c_value
.
indexOf
(
"
;
"
,
c_start
);
if
(
c_end
==
-
1
){
c_end
=
c_value
.
length
;}
c_value
=
unescape
(
c_value
.
substring
(
c_start
,
c_end
));}
return
c_value
;}
function
delCookie
(
name
){
document
.
cookie
=
name
+
'
=; expires=Thu, 01 Jan 1970 00:00:01 GMT;
'
;}
//
function setCookie(c_name,value,exdays){var exdate=new Date();exdate.setDate(exdate.getDate() + exdays);var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());document.cookie=c_name + "=" + c_value;}
//
function getCookie(c_name){var c_value = document.cookie;var c_start = c_value.indexOf(" " + c_name + "=");if (c_start == -1){c_start = c_value.indexOf(c_name + "=");}if (c_start == -1){c_value = null;}else{c_start = c_value.indexOf("=", c_start) + 1;var c_end = c_value.indexOf(";", c_start);if (c_end == -1){c_end = c_value.length;}c_value = unescape(c_value.substring(c_start,c_end));}return c_value;}
//
function delCookie(name){document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';}
$
(
function
()
{
...
...
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