Hi there,
I'm working on importing a Collada file that has pre-defined animations in the DAE. I've gotten the project to the point where I can see my 3D object, but there is no animation. I've taken a look at ProceduralAnimationSample.java, but am not entirely sure which part to add in order to make this work. I'm new to this and am sure there is some fundamental information that I don't have, so if anyone can point in me in the right direction that'd be appreciated.
Here is what I currently have:
//copy the res file to storage
val uri:URI = URI("file://" + outDir.absolutePath)
val resLocator = SimpleResourceLocator(uri) //URI("android.resource://"+ mActivity.applicationContext.packageName +"/raw/seymour_dae"))
ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_MODEL, resLocator)
try {
val colladaImporter = ColladaImporter()
colladaImporter.loadTextures(false)
val colladaStorage = colladaImporter.load("test.dae")
animatedGroup = BonesImporter.importCollada(colladaStorage, 1f, null)
animatedGroup!!.isAutoApplyAnimation = false
} finally {
ResourceLocatorTool.removeResourceLocator(ResourceLocatorTool.TYPE_MODEL, resLocator)
}
for (o in animatedGroup!!) {
o.setTexture("floor2.jpg")
o.build()
o.discardMeshData()
}
animatedGroup!!.addToWorld(world)
animatedGroup!!.get(0).skeletonPose.updateTransforms()
animatedGroup!!.applySkeletonPose()
animatedGroup!!.applyAnimation()
//point camera to look at the center of the animated group
var transformedCenter : SimpleVector? = null
for (o in animatedGroup!!) {
o.visibility = true
transformedCenter = o.transformedCenter
}
cam.lookAt(transformedCenter!!)
}
Cheers