File tree 5 files changed +224
-15
lines changed
App_Resources/iOS/Models.scnassets
5 files changed +224
-15
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ export function arLoaded(args: ARLoadedEventData): void {
151
151
152
152
export function trackingFaceDetected ( args : ARTrackingFaceEventData ) : void {
153
153
if ( args . properties ) {
154
- console . log ( JSON . stringify ( args . properties ) ) ;
154
+ // console.log(JSON.stringify(args.properties));
155
155
}
156
156
157
157
if ( args . faceTrackingActions ) {
@@ -177,16 +177,16 @@ export function trackingFaceDetected(args: ARTrackingFaceEventData): void {
177
177
} , 500 ) ;
178
178
179
179
args . faceTrackingActions . addModel ( {
180
- name : "Models.scnassets/glasses2.obj " ,
180
+ name : "Models.scnassets/glasses-vv-1.dae " ,
181
181
position : {
182
- x : 0 ,
183
- y : - 0.007 , // a little lower
184
- z : 0.06 // a little closer to the camera
182
+ x : 0.001 ,
183
+ y : 0.01 ,
184
+ z : 0
185
185
} ,
186
186
scale : {
187
- x : 0.0045 ,
188
- y : 0.0045 ,
189
- z : 0.0045
187
+ x : 1.03 ,
188
+ y : 1.03 ,
189
+ z : 1.03
190
190
} ,
191
191
onTap : ( interaction : ARNodeInteraction ) => {
192
192
// let's remove the current glasses, and replace it by a different model
@@ -210,7 +210,7 @@ export function trackingFaceDetected(args: ARTrackingFaceEventData): void {
210
210
}
211
211
} ) ;
212
212
213
- textModel . remove ( ) ;
213
+ // textModel.remove();
214
214
args . faceTrackingActions . addText ( {
215
215
text : "Ray-Ban Opaque" ,
216
216
materials : [ new Color ( "orange" ) ] ,
Original file line number Diff line number Diff line change 14
14
trackingImageDetected =" trackingImageDetected"
15
15
trackingFaceDetected =" trackingFaceDetected"
16
16
debugLevel =" FEATURE_POINTS"
17
- faceMaterial =" Assets.scnassets/Materials/tnsgranite/tnsgranite-diffuse.png"
18
- faceMaterial__DISABLED =" Assets.xcassets/wireframeTexture.imageset"
17
+ faceMaterial__DISABLED =" Assets.scnassets/Materials/tnsgranite/tnsgranite-diffuse.png"
18
+ faceMaterial__DISABLED2 =" Assets.xcassets/wireframeTexture.imageset"
19
19
planeMaterial =" {{ planeMaterial }}"
20
20
planeOpacity =" 0.25"
21
21
detectPlanes =" true"
Original file line number Diff line number Diff line change @@ -2,10 +2,18 @@ import { ARAddModelOptions } from "../../ar-common";
2
2
import { ARCommonNode } from "./arcommon" ;
3
3
4
4
export class ARModel extends ARCommonNode {
5
- // note that these babies can be cloned, look for 'clone' at http://jamesonquave.com/blog/arkit-tutorial-in-swift-4-for-xcode-9-using-scenekit/
6
5
static create ( options : ARAddModelOptions ) {
7
6
let modelScene = SCNScene . sceneNamed ( options . name ) ;
8
- let nodeModel = options . childNodeName ? modelScene . rootNode . childNodeWithNameRecursively ( options . childNodeName , true ) : modelScene . rootNode ;
9
- return new ARModel ( options , nodeModel ) ;
7
+
8
+ let nodeModel : SCNNode ;
9
+ if ( options . childNodeName ) {
10
+ nodeModel = modelScene . rootNode . childNodeWithNameRecursively ( options . childNodeName , true ) ;
11
+ } else if ( modelScene . rootNode . childNodes . count === 1 ) {
12
+ nodeModel = modelScene . rootNode . childNodes . objectAtIndex ( 0 ) ;
13
+ } else {
14
+ nodeModel = modelScene . rootNode ;
15
+ }
16
+
17
+ return new ARModel ( options , nodeModel . clone ( ) ) ;
10
18
}
11
19
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " nativescript-ar" ,
3
- "version" : " 0.7.2 " ,
3
+ "version" : " 0.8.0 " ,
4
4
"description" : " NativeScript Augmented Reality plugin. ARKit on iOS and (in the future) ARCore on Android." ,
5
5
"main" : " ar" ,
6
6
"typings" : " index.d.ts" ,
You can’t perform that action at this time.
0 commit comments