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
ca9c0d2c
Commit
ca9c0d2c
authored
Oct 4, 2017
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
debugging
parent
f386a9a7
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
dependencies/datguivr.js
+5
-3
5 additions, 3 deletions
dependencies/datguivr.js
js/VRInterface.js
+18
-7
18 additions, 7 deletions
js/VRInterface.js
with
23 additions
and
10 deletions
dependencies/datguivr.js
+
5
−
3
View file @
ca9c0d2c
...
@@ -1461,6 +1461,7 @@ var GUIVR = function DATGUIVR() {
...
@@ -1461,6 +1461,7 @@ var GUIVR = function DATGUIVR() {
pressed: false,
pressed: false,
gripped: false,
gripped: false,
events: new _events2.default(),
events: new _events2.default(),
enabled: true,
interaction: {
interaction: {
grip: undefined,
grip: undefined,
press: undefined,
press: undefined,
...
@@ -1556,7 +1557,7 @@ var GUIVR = function DATGUIVR() {
...
@@ -1556,7 +1557,7 @@ var GUIVR = function DATGUIVR() {
inputObjects.push(input);
inputObjects.push(input);
return input
.laser
;
return input;
}
}
/*
/*
...
@@ -1741,8 +1742,9 @@ var GUIVR = function DATGUIVR() {
...
@@ -1741,8 +1742,9 @@ var GUIVR = function DATGUIVR() {
}
}
inputObjects.forEach(function () {
inputObjects.forEach(function () {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
box = _ref.box,
if (!_ref.enabled) return;
var box = _ref.box,
object = _ref.object,
object = _ref.object,
raycast = _ref.raycast,
raycast = _ref.raycast,
laser = _ref.laser,
laser = _ref.laser,
...
...
This diff is collapsed.
Click to expand it.
js/VRInterface.js
+
18
−
7
View file @
ca9c0d2c
...
@@ -30,6 +30,7 @@ function initViveInterface(globals){
...
@@ -30,6 +30,7 @@ function initViveInterface(globals){
var
nodes
=
[
null
,
null
];
var
nodes
=
[
null
,
null
];
var
intersections
=
[
false
,
false
];
var
intersections
=
[
false
,
false
];
var
guiHelpers
=
[
null
,
null
];
connect
();
connect
();
...
@@ -42,7 +43,7 @@ function initViveInterface(globals){
...
@@ -42,7 +43,7 @@ function initViveInterface(globals){
stepsPerFrame
:
globals
.
numSteps
,
stepsPerFrame
:
globals
.
numSteps
,
damping
:
globals
.
percentDamping
,
damping
:
globals
.
percentDamping
,
strainMap
:
false
,
strainMap
:
false
,
position
:
new
THREE
.
Vector3
(
0
,
1.
6
,
0
)
position
:
new
THREE
.
Vector3
(
0
,
1.
3
,
0
)
};
};
var
gui
=
dat
.
GUIVR
.
create
(
'
Settings
'
);
var
gui
=
dat
.
GUIVR
.
create
(
'
Settings
'
);
...
@@ -108,8 +109,8 @@ function initViveInterface(globals){
...
@@ -108,8 +109,8 @@ function initViveInterface(globals){
controller
.
head
=
camera
;
controller
.
head
=
camera
;
var
var
meshColorOff
=
0x
555555
,
meshColorOff
=
0x
888888
,
meshColorOn
=
0x
888888
,
meshColorOn
=
0x
cccccc
,
controllerMaterial
=
new
THREE
.
MeshStandardMaterial
({
controllerMaterial
=
new
THREE
.
MeshStandardMaterial
({
color
:
meshColorOff
color
:
meshColorOff
}),
}),
...
@@ -130,15 +131,16 @@ function initViveInterface(globals){
...
@@ -130,15 +131,16 @@ function initViveInterface(globals){
controller
.
add
(
controllerMesh
);
controller
.
add
(
controllerMesh
);
var
guiInputHelper
=
dat
.
GUIVR
.
addInputObject
(
controller
);
var
guiInputHelper
=
dat
.
GUIVR
.
addInputObject
(
controller
);
scene
.
add
(
guiInputHelper
);
scene
.
add
(
guiInputHelper
.
laser
);
guiHelpers
[
controllerIndex
]
=
guiInputHelper
;
controller
.
addEventListener
(
'
primary press began
'
,
function
(
event
){
controller
.
addEventListener
(
'
primary press began
'
,
function
(
event
){
event
.
target
.
userData
.
mesh
.
material
.
color
.
setHex
(
meshColorOn
);
event
.
target
.
userData
.
mesh
.
material
.
color
.
setHex
(
meshColorOn
);
states
[
controllerIndex
]
=
true
;
states
[
controllerIndex
]
=
true
;
if
(
intersections
[
controllerIndex
]
||
nodes
[
controllerIndex
])
{
if
(
intersections
[
controllerIndex
]
||
nodes
[
controllerIndex
])
{
guiInputHelper
.
pressed
(
false
);
guiInputHelper
.
laser
.
pressed
(
false
);
}
else
guiInputHelper
.
pressed
(
true
);
}
else
guiInputHelper
.
laser
.
pressed
(
true
);
});
});
controller
.
addEventListener
(
'
primary press ended
'
,
function
(
event
){
controller
.
addEventListener
(
'
primary press ended
'
,
function
(
event
){
event
.
target
.
userData
.
mesh
.
material
.
color
.
setHex
(
meshColorOff
);
event
.
target
.
userData
.
mesh
.
material
.
color
.
setHex
(
meshColorOff
);
...
@@ -147,7 +149,7 @@ function initViveInterface(globals){
...
@@ -147,7 +149,7 @@ function initViveInterface(globals){
nodes
[
controllerIndex
].
setFixed
(
false
);
nodes
[
controllerIndex
].
setFixed
(
false
);
globals
.
fixedHasChanged
=
true
;
globals
.
fixedHasChanged
=
true
;
}
}
guiInputHelper
.
pressed
(
false
);
guiInputHelper
.
laser
.
pressed
(
false
);
});
});
controller
.
addEventListener
(
'
disconnected
'
,
function
(
event
){
controller
.
addEventListener
(
'
disconnected
'
,
function
(
event
){
...
@@ -222,6 +224,12 @@ function initViveInterface(globals){
...
@@ -222,6 +224,12 @@ function initViveInterface(globals){
var
tMatrix
=
new
THREE
.
Matrix4
();
var
tMatrix
=
new
THREE
.
Matrix4
();
var
tDirection
=
new
THREE
.
Vector3
(
0
,
0
,
-
1
);
var
tDirection
=
new
THREE
.
Vector3
(
0
,
0
,
-
1
);
function
disableLaserPointer
(
helper
){
helper
.
enabled
=
false
;
helper
.
laser
.
visible
=
false
;
helper
.
cursor
.
visible
=
false
;
}
function
checkForIntersections
(){
function
checkForIntersections
(){
var
numControllers
=
controllers
.
length
;
var
numControllers
=
controllers
.
length
;
if
(
numControllers
>
2
){
if
(
numControllers
>
2
){
...
@@ -245,6 +253,7 @@ function initViveInterface(globals){
...
@@ -245,6 +253,7 @@ function initViveInterface(globals){
if
(
states
[
i
]
&&
nodes
[
i
]){
if
(
states
[
i
]
&&
nodes
[
i
]){
//drag node
//drag node
disableLaserPointer
(
guiHelpers
[
i
]);
if
(
!
nodes
[
i
].
isFixed
())
{
if
(
!
nodes
[
i
].
isFixed
())
{
nodes
[
i
].
setFixed
(
true
);
nodes
[
i
].
setFixed
(
true
);
globals
.
fixedHasChanged
=
true
;
globals
.
fixedHasChanged
=
true
;
...
@@ -260,6 +269,7 @@ function initViveInterface(globals){
...
@@ -260,6 +269,7 @@ function initViveInterface(globals){
var
cast
=
new
THREE
.
Raycaster
(
position
,
tDirection
,
0
,
1
);
var
cast
=
new
THREE
.
Raycaster
(
position
,
tDirection
,
0
,
1
);
var
intersects
=
cast
.
intersectObjects
(
globals
.
model
.
getMesh
(),
false
);
var
intersects
=
cast
.
intersectObjects
(
globals
.
model
.
getMesh
(),
false
);
if
(
intersects
.
length
>
0
){
if
(
intersects
.
length
>
0
){
disableLaserPointer
(
guiHelpers
[
i
]);
intersections
[
i
]
=
true
;
intersections
[
i
]
=
true
;
var
intersection
=
intersects
[
0
];
var
intersection
=
intersects
[
0
];
var
face
=
intersection
.
face
;
var
face
=
intersection
.
face
;
...
@@ -292,6 +302,7 @@ function initViveInterface(globals){
...
@@ -292,6 +302,7 @@ function initViveInterface(globals){
}
else
{
}
else
{
intersections
[
i
]
=
false
;
intersections
[
i
]
=
false
;
nodes
[
i
]
=
null
;
nodes
[
i
]
=
null
;
guiHelpers
[
i
].
enabled
=
true
;
}
}
}
else
{
}
else
{
...
...
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
register
or
sign in
to comment