Hi,
I'm writing my own file format. I have some problem with animators.
I have a node and it's animators from getAnimators(), next I check what type is this animator by getType().
And now if i get for example ESNAT_ROTATION where i can find that rotation vector?
There is only ISceneNodeAnimator abstract class, there in no such thing like RotationAnimator.
The same problem with other types of animators. Need some advice.
Animators
If the create...Animator() function you call returns an ISceneNodeAnimator*, there probably isn't an interface for the derived animator. i.e., createRotationAnimator() returns a ISceneNodeAnimator*. This is a pretty good indicator that there isn't an ISceneNodeAnimatorRotation type that has getRotation() or setRotation(), so there is no clean way for you to get at the rotation values.
Travis
Travis
-
- Posts: 11
- Joined: Sat May 23, 2009 11:39 am
- Location: Poland
irrEdit does use the serialization mechanism. Each node does overload serializeAttributes and deserializeAttributes. I'm not sure if that is the best way to access the value in your case, but it would be possible for you to access the rotation vector by wrapping or directly using that serialization mechanism. The other possibility would probably be to change the engine.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Like I said, there is no clean way for you to get the rotation values. The ISceneNodeAnimator interface does support serializing/deserializing the values, so you can access the data that way. I provided code in this thread for getting/modifying attributes for a particle emitter a while back. You could use it to write something like this...
Code: Select all
bool ISceneNodeAnimator_getRotation(io::IFileSystem* fs, scene::ISceneNodeAnimator* animator, core::vector3df& rot)
{
io::IAttributes* attribs = fs->createEmptyAttributes();
if (!attribs)
return false;
bool success = false;
for (; /* once */;)
{
// get the attributes out of the emitter
animator->serializeAttributes(attribs);
const s32 index = attribs->findAttribute("Rotation");
if (index < 0)
break;
if (io::EAT_VECTOR3D != attribs->getAttributeType(index))
break;
rotation = attribs->getAttributeAsVector3d(index);
success = true;
}
attribs->drop();
return success;
}