Bones - Skeletal and Pose Animations for jPCT/jPCT-AE > Bones

Loading a Collada file with pre-defined animations

(1/2) > >>

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, 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:

--- Code: ---       

//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()
            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!!) {


        //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
--- End code ---


try using ColladaSample, it displays the animations in the file and you can run them through the GUI

Perfect, thanks! I've gotten it up and running using that sample.  However, I've noticed that there are some objects that are missing from my animation.  The animation is supposed to be a man holding some coins and throwing them into the air, however the coins don't show up at all. Is there anything I should be looking out for when rendering a DAE that isn't just one solid 'object'?
 Along with that, the coins also have a different texture than the man, so I will be supporting multiple textures.  How is that handled, if at all? Also sorry if this is the wrong place to ask it/if I should be looking into Ardor3D, instead. Thanks again!

if there are multiple objects in the collada file, they should be listed in the collada sample like in the screenshot below. in this case there are 4 objects. if your coins is not listed, I guess it means they are not exported

the collada sample just sets the same texture to all objects. you can set different textures to different objects like with the code below. but of course you need the index of object in the group

--- Code: ---skinnedGroup.get(index).setTexture(name);
--- End code ---

Thanks for the reply! I believe the coins did get exported... if I open the DAE file I see the node/geometry declarations for each one.  The animation is also appearing properly if I preview the file.

As far as the texture issue,  I guess I'm more curious about whether it's possible to get these texture files and set them programatically, instead of me finding the proper index and setting the texture.  The use case is that I will be scanning various target that will each trigger different 3d objects, so I'd prefer not to have to define these beforehand.  Is there no way to handle textures automatically, even if they are predefined in the DAE (using init_from tag)?


[0] Message Index

[#] Next page

Go to full version