Node* spitfireNode = scene_->CreateChild("Spitfire");
spitfireNode->SetPosition(Vector3(0.0f, 5.0f, 0.0f));
AnimatedModel* spitfireObject = spitfireNode->CreateComponent<AnimatedModel>();
spitfireObject->SetModel(cache->GetResource<Model>("Models/spidfire4_animation_2.mdl"));
spitfireObject->SetMaterial(cache->GetResource<Material>("Materials/Body_Material_001-material.xml"));
spitfireObject->SetMaterial(cache->GetResource<Material>("Materials/plopellor_head_Material-material.xml"));
spitfireObject->SetMaterial(cache->GetResource<Material>("Materials/plopellor_Material-material.xml"));
Animation* plopellorAnimation = cache->GetResource<Animation>("Models/Anim1.ani");
AnimationState* state = spitfireObject->AddAnimationState(plopellorAnimation); //HERE THE STATE IS NOT SET
// The state would fail to create (return null) if the animation was not found
if (state) //NEVER ENTERS HERE
{
// Enable full blending weight and looping
state->SetWeight(1.0f);
state->SetLooped(true);
}
I have no actual indepth experience with Blender (beyond making simple objects and pressing export), so you have to look up some online tutorials, or perhaps someone else can answer.
StaticModel* ModelObject = CarNode->CreateComponent<StaticModel>();
ModelObject->SetModel(cache->GetResource<Model>("Models/spidfire4_animation_2.mdl"));
ModelObject->SetMaterial(cache->GetResource<Material>("Materials/Body_Material_001-material.xml"));
ModelObject->SetMaterial(cache->GetResource<Material>("Materials/plopellor_head_Material-material.xml"));
ModelObject->SetMaterial(cache->GetResource<Material>("Materials/plopellor_Material-material.xml"));
ModelObject->SetCastShadows(true);
Animation* plopelorAnimation = cache->GetResource<Animation>("Models/Anim1.ani");
D:\dev\cpp\3d\Urho3D\Bin>AssetImporter.exe scene models\spitfire\anim\Collada\spidfire4_animation_2.dae models\spitfire\anim\output\spidfire4_animation_2.mdl
Reading file models\spitfire\anim\Collada\spidfire4_animation_2.dae
Added model models/spitfire/anim/output/Models/Body.mdl
Added node Body
Added model models/spitfire/anim/output/Models/Cone_plopelor_head.mdl
Added node Cone_plopelor_head
Added model models/spitfire/anim/output/Models/BezierCircle_plopelor.mdl
Added node BezierCircle_plopelor
Writing model Body
Writing geometry 0 with 1154 vertices 1392 indices
Writing model Cone_plopelor_head
Writing geometry 0 with 121 vertices 204 indices
Writing model BezierCircle_plopelor
Writing geometry 0 with 2280 vertices 2280 indices
Writing animation Anim1 length 0.416667
Writing scene
Writing material Body_Material_001-material
Writing material plopellor_Material-material
Writing material plopellor_head_Material-material
Copying texture body_texture.png
Copying texture UVPlopelor.png
Copying texture plopellor_head.png
[Tue Jan 14 18:59:51 2014] ERROR: Models/spidfire4_animation_2.xml is not a valid model file
D:\dev\cpp\3d\Urho3d_forwindows\Bin>AssetImporter.exe scene models\spidfire\anim_scene\spidfire4_animation_2.dae models\spidfire\anim_scene\spidfire4_animation_2.xml
Reading file models\spidfire\anim_scene\spidfire4_animation_2.dae
Added model models/spidfire/anim_scene/Models/Body.mdl
Added node Body
Added model models/spidfire/anim_scene/Models/Cone_plopelor_head.mdl
Added node Cone_plopelor_head
Added model models/spidfire/anim_scene/Models/BezierCircle_plopelor.mdl
Added node BezierCircle_plopelor
Writing model Body
Writing geometry 0 with 1154 vertices 1392 indices
Writing model Cone_plopelor_head
Writing geometry 0 with 122 vertices 204 indices
Writing model BezierCircle_plopelor
Writing geometry 0 with 2280 vertices 2280 indices
Writing animation Anim1 length 0.416667
Writing scene
Writing material Body_Material_001-material
Writing material plopellor_Material-material
Writing material plopellor_head_Material-material
Copying texture body_texture.png
Copying texture UVPlopelor.png
Copying texture plopellor_head.png
Node* spitfireNode = scene_->CreateChild("Spitfire");
spitfireNode->SetPosition(Vector3(0.0f, 5.0f, 0.0f));
StaticModel* spitfireObject = spitfireNode->CreateComponent<StaticModel>();
spitfireObject->SetModel(cache->GetResource<Model>("Models/spidfire4_animation_2.xml"));
spitfireObject->SetMaterial(cache->GetResource<Material>("Materials/Body_Material_001-material.xml"));
spitfireObject->SetMaterial(cache->GetResource<Material>("Materials/plopellor_head_Material-material.xml"));
spitfireObject->SetMaterial(cache->GetResource<Material>("Materials/plopellor_Material-material.xml"));
Animation* plopellorAnimation = cache->GetResource<Animation>("Models/Anim1.ani");