Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OrigamiSimulator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Amanda Ghassaei
OrigamiSimulator
Commits
ca9c0d2c
Commit
ca9c0d2c
authored
Oct 03, 2017
by
Amanda Ghassaei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugging
parent
f386a9a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
10 deletions
+23
-10
dependencies/datguivr.js
dependencies/datguivr.js
+5
-3
js/VRInterface.js
js/VRInterface.js
+18
-7
No files found.
dependencies/datguivr.js
View file @
ca9c0d2c
...
...
@@ -1461,6 +1461,7 @@ var GUIVR = function DATGUIVR() {
pressed: false,
gripped: false,
events: new _events2.default(),
enabled: true,
interaction: {
grip: undefined,
press: undefined,
...
...
@@ -1556,7 +1557,7 @@ var GUIVR = function DATGUIVR() {
inputObjects.push(input);
return input
.laser
;
return input;
}
/*
...
...
@@ -1741,8 +1742,9 @@ var GUIVR = function DATGUIVR() {
}
inputObjects.forEach(function () {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
box = _ref.box,
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (!_ref.enabled) return;
var box = _ref.box,
object = _ref.object,
raycast = _ref.raycast,
laser = _ref.laser,
...
...
js/VRInterface.js
View file @
ca9c0d2c
...
...
@@ -30,6 +30,7 @@ function initViveInterface(globals){
var
nodes
=
[
null
,
null
];
var
intersections
=
[
false
,
false
];
var
guiHelpers
=
[
null
,
null
];
connect
();
...
...
@@ -42,7 +43,7 @@ function initViveInterface(globals){
stepsPerFrame
:
globals
.
numSteps
,
damping
:
globals
.
percentDamping
,
strainMap
:
false
,
position
:
new
THREE
.
Vector3
(
0
,
1.
6
,
0
)
position
:
new
THREE
.
Vector3
(
0
,
1.
3
,
0
)
};
var
gui
=
dat
.
GUIVR
.
create
(
'
Settings
'
);
...
...
@@ -108,8 +109,8 @@ function initViveInterface(globals){
controller
.
head
=
camera
;
var
meshColorOff
=
0x
555555
,
meshColorOn
=
0x
888888
,
meshColorOff
=
0x
888888
,
meshColorOn
=
0x
cccccc
,
controllerMaterial
=
new
THREE
.
MeshStandardMaterial
({
color
:
meshColorOff
}),
...
...
@@ -130,15 +131,16 @@ function initViveInterface(globals){
controller
.
add
(
controllerMesh
);
var
guiInputHelper
=
dat
.
GUIVR
.
addInputObject
(
controller
);
scene
.
add
(
guiInputHelper
);
scene
.
add
(
guiInputHelper
.
laser
);
guiHelpers
[
controllerIndex
]
=
guiInputHelper
;
controller
.
addEventListener
(
'
primary press began
'
,
function
(
event
){
event
.
target
.
userData
.
mesh
.
material
.
color
.
setHex
(
meshColorOn
);
states
[
controllerIndex
]
=
true
;
if
(
intersections
[
controllerIndex
]
||
nodes
[
controllerIndex
])
{
guiInputHelper
.
pressed
(
false
);
}
else
guiInputHelper
.
pressed
(
true
);
guiInputHelper
.
laser
.
pressed
(
false
);
}
else
guiInputHelper
.
laser
.
pressed
(
true
);
});
controller
.
addEventListener
(
'
primary press ended
'
,
function
(
event
){
event
.
target
.
userData
.
mesh
.
material
.
color
.
setHex
(
meshColorOff
);
...
...
@@ -147,7 +149,7 @@ function initViveInterface(globals){
nodes
[
controllerIndex
].
setFixed
(
false
);
globals
.
fixedHasChanged
=
true
;
}
guiInputHelper
.
pressed
(
false
);
guiInputHelper
.
laser
.
pressed
(
false
);
});
controller
.
addEventListener
(
'
disconnected
'
,
function
(
event
){
...
...
@@ -222,6 +224,12 @@ function initViveInterface(globals){
var
tMatrix
=
new
THREE
.
Matrix4
();
var
tDirection
=
new
THREE
.
Vector3
(
0
,
0
,
-
1
);
function
disableLaserPointer
(
helper
){
helper
.
enabled
=
false
;
helper
.
laser
.
visible
=
false
;
helper
.
cursor
.
visible
=
false
;
}
function
checkForIntersections
(){
var
numControllers
=
controllers
.
length
;
if
(
numControllers
>
2
){
...
...
@@ -245,6 +253,7 @@ function initViveInterface(globals){
if
(
states
[
i
]
&&
nodes
[
i
]){
//drag node
disableLaserPointer
(
guiHelpers
[
i
]);
if
(
!
nodes
[
i
].
isFixed
())
{
nodes
[
i
].
setFixed
(
true
);
globals
.
fixedHasChanged
=
true
;
...
...
@@ -260,6 +269,7 @@ function initViveInterface(globals){
var
cast
=
new
THREE
.
Raycaster
(
position
,
tDirection
,
0
,
1
);
var
intersects
=
cast
.
intersectObjects
(
globals
.
model
.
getMesh
(),
false
);
if
(
intersects
.
length
>
0
){
disableLaserPointer
(
guiHelpers
[
i
]);
intersections
[
i
]
=
true
;
var
intersection
=
intersects
[
0
];
var
face
=
intersection
.
face
;
...
...
@@ -292,6 +302,7 @@ function initViveInterface(globals){
}
else
{
intersections
[
i
]
=
false
;
nodes
[
i
]
=
null
;
guiHelpers
[
i
].
enabled
=
true
;
}
}
else
{
...
...
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