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
b43aec70
Commit
b43aec70
authored
Oct 02, 2017
by
Amanda Ghassaei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vr changes
parent
a169ee0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
js/VRInterface.js
js/VRInterface.js
+11
-11
No files found.
js/VRInterface.js
View file @
b43aec70
...
...
@@ -128,7 +128,6 @@ function initViveInterface(globals){
controller
.
userData
.
mesh
=
controllerMesh
;
controller
.
add
(
controllerMesh
);
var
guiInputHelper
=
dat
.
GUIVR
.
addInputObject
(
controller
);
scene
.
add
(
guiInputHelper
);
...
...
@@ -211,6 +210,10 @@ function initViveInterface(globals){
renderer
.
render
(
scene
,
camera
);
}
var
tMatrix
=
new
THREE
.
Matrix4
();
var
tDirection
=
new
THREE
.
Vector3
(
0
,
0
,
-
1
);
function
checkForIntersections
(){
var
numControllers
=
controllers
.
length
;
if
(
numControllers
>
2
){
...
...
@@ -227,7 +230,11 @@ function initViveInterface(globals){
var
position
=
controllers
[
i
].
position
.
clone
();
position
.
applyMatrix4
(
renderer
.
vr
.
getStandingMatrix
());
position
.
add
((
new
THREE
.
Vector3
(
0
,
0
,
-
0.06
)).
applyQuaternion
(
controllers
[
i
].
quaternion
));
tMatrix
.
identity
().
extractRotation
(
controllers
[
i
].
matrixWorld
);
tDirection
.
set
(
0
,
0
,
-
1
).
applyMatrix4
(
tMatrix
).
normalize
();
position
.
add
(
tDirection
.
clone
().
multiplyScalar
(
0.05
));
if
(
states
[
i
]
&&
nodes
[
i
]){
//drag node
...
...
@@ -242,22 +249,15 @@ function initViveInterface(globals){
continue
;
}
var
direction
=
new
THREE
.
Vector3
(
0
,
0
,
-
1
);
direction
.
applyQuaternion
(
controllers
[
i
].
quaternion
);
position
.
add
(
direction
.
clone
().
multiplyScalar
(
-
0.05
));
//todo get position and mesh in same reference frame
var
cast
=
new
THREE
.
Raycaster
(
position
,
direction
,
-
0.1
,
10
);
var
cast
=
new
THREE
.
Raycaster
(
position
,
tDirection
,
-
0.1
,
0.2
);
var
intersects
=
cast
.
intersectObjects
(
globals
.
model
.
getMesh
(),
false
);
if
(
intersects
.
length
>
0
){
var
intersection
=
intersects
[
0
];
var
face
=
intersection
.
face
;
var
point
=
intersection
.
point
;
if
(
point
.
clone
().
sub
(
position
).
length
()
>
0.2
)
{
nodes
[
i
]
=
null
;
continue
;
}
var
positionsArray
=
globals
.
model
.
getPositionsArray
();
var
vertices
=
[];
vertices
.
push
(
new
THREE
.
Vector3
(
positionsArray
[
3
*
face
.
a
],
positionsArray
[
3
*
face
.
a
+
1
],
positionsArray
[
3
*
face
.
a
+
2
]));
...
...
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