Rofar
Member
|
Animated Objects
I have spent the past week learning the tools and playing with the world editor, exploring Bloody Massacre and the tutorials. One thing I haven't quite figured out is how to put an anmated object in the world and have the animation loop. I have a mesh with a single bone and a simple rotatiing animation. In the mesh editor, I have saved the skeleton, mesh, materials, and animation. I have placed an object in the world with the mesh and skeleton selected. I'm not surprised that there is no animation in the world editor or in the play mode because there doesn't appear to be a way to identify an animation there. I assume I have to do that in code but I'm really not sure how to go about doing that. I'm thinking maybe I need to access the object from an extended memory block filled with the world objects. I'm also wondering if I would need to use a custom object type enum for this type of object.
Could you possibly point me in the right direction here?
|
|
11-09-2009 04:02 AM |
|
Esenthel
Administrator
|
RE: Animated Objects
hi,
it should be something like this:
Code:
struct AnimatedStatic : Static
{
Skeleton *skel;
CSkeleton cskel;
void create(..)
{
__super::create(..);
skel=obj_params.skel();
cskel.create(..)
}
Bool update()
{
cskel.clear().animate(..). ....
return __super::update();
}
void draw()
{
if(mesh)mesh->draw(cskel);
}
}
|
|
11-09-2009 12:58 PM |
|
Rofar
Member
|
RE: Animated Objects
Thanks! That looks pretty much like what I was thinking to try.
(This post was last modified: 11-12-2009 12:10 AM by Rofar.)
|
|
11-10-2009 12:11 AM |
|
Rofar
Member
|
RE: Animated Objects
I still don't have something quite right. I created AnimatedStatic and created an Enum OBJ_ANIMSTATIC so I could set the AnimatedStatic memory container for the world. The update and draw methods are getting called for the object but the object does not render. If I call the base draw method, it renders as just a static object.
The object also doesn't show up in the world editor now that I have set it to type of OBJ_ANIMSTATIC.
|
|
11-12-2009 12:10 AM |
|
Esenthel
Administrator
|
RE: Animated Objects
Hi
Quote:The object also doesn't show up in the world editor now that I have set it to type of OBJ_ANIMSTATIC.
if you mean the Play option then this is normal
Quote:The update and draw methods are getting called for the object but the object does not render.
for rendering animated meshes please see tutorials in "Animation" folder
perhaps you also need to implement save/load methods (check tutorials in game basics)
|
|
11-12-2009 02:49 PM |
|
Rofar
Member
|
RE: Animated Objects
(11-12-2009 02:49 PM)Esenthel Wrote: Quote:The object also doesn't show up in the world editor now that I have set it to type of OBJ_ANIMSTATIC.
if you mean the Play option then this is normal
I guess I understand this but since the object is based on OBJ_STATIC, I was thinking it might still render as a Static in the world editor. I understand why it doesn't though.
|
|
11-13-2009 12:32 AM |
|
Rofar
Member
|
RE: Animated Objects
Got it working. I was missing the call to updateMatrix in my update function.
|
|
11-13-2009 01:33 AM |
|