从我之前的问题来看,我相信克隆SCNNode是解决加载多个对象问题的方法。然而,我意识到有些不对劲。
我做了类似的事情
arrow = scnScene.rootNode.childNode(withName: "arrow", recursively:true)
arrow.rotation = SCNVector4(0, 0, 1, M_PI_2)
arrow.position = SCNVector3(x: 0, y: 0, z: -3);
let sign = SCNNode()
for i in 0..<10{
let node = arrow.clone()
node.position = SCNVector3(i+1,0,0)
sign.addChildNode(node)
}
arrow.addChildNode(sign)
Run Code Online (Sandbox Code Playgroud)
我期望显示一排箭头,但实际上有一列箭头(在 x 轴平移但实际上影响 y 轴,似乎克隆节点的坐标系已更改)显示,并且所有子对象旋转 180 度。为什么?
在Karl Sigiscar告诉我使用SCNReferenceNode之前,我不确定我应该如何使用它,它会达到我的目的吗?
更新:
我尝试了这样的 SCNReferenceNode :
let scnScene = SCNScene()
if let filePath = Bundle.main.path(forResource: "arrowsign", ofType: "dae", inDirectory: "art.scnassets") {
// ReferenceNode path -> ReferenceNode URL
let referenceURL = NSURL(fileURLWithPath: filePath) …Run Code Online (Sandbox Code Playgroud) 我按照本教程使用导出用于unity3d的jar文件,并参考此文件解决了我的问题,但是,我仍然在项目中找不到任何jar文件,发布目录为空。
我的build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
// applicationId "com.aoshitang.demo"
minSdkVersion 21
targetSdkVersion 28
// versionCode 1
// versionName "1.0"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation files('libs/unityClasses.jar')
}
task clearJar(type: Delete) {
delete 'release/AndroidSensorPlugin.jar'
}
task makeJar(type: Copy) {
from('build/intermediates/bundles/release/')
into('release/')
include('classes.jar')
rename ('classes.jar', …Run Code Online (Sandbox Code Playgroud)