On 04/07/2016 at 10:16, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 14+
Platform:
Language(s) : C++ ;
---------
Hi,
I have an object generator plugin with an external class whose members I want to update within GetVirtualObjects.
This is how I am defining my external class:
// object generator class
class myPlugin: public ObjectData
{
INSTANCEOF(myPlugin, ObjectData);
public:
virtual Bool Message(GeListNode *node, LONG type, void *data);
virtual BaseObject* GetVirtualObjects(BaseObject *op, HierarchyHelp *hh);
virtual Bool Init(GeListNode *node);
virtual DRAWRESULT Draw(BaseObject *op, DRAWPASS drawpass, BaseDraw *bd, BaseDrawHelp *bh);
static NodeData* Alloc(void) { return gNew myPlugin; }
};
class myCharacter
{
public:
Vector position;
myCharacter()
{
position= Vector(0,0,0);
}
void walk()
{
position += Vector(10,0,0);
}
};
Now inside GetVirtualObjects (GVO), I want to update the position at every frame.
myCharacter c;
c.walk();
outputVector(c.position); //does not update unless I call c.walk() again and again
P.S. outputVector is a custom function that outputs a vector to the console
I have 2 questions:
1. Is this the right way of using a custom class beside the plugin class?
2. How do I update the walk() function at every frame inside GVO ?