Anyone use SimComponent?
by Charlie Patterson · in Torque 2D Professional · 05/27/2013 (4:50 pm) · 3 replies
I'm curious about the use of SimComponent. Does anybody?
What it does (I think)
Reading the code, I can only barely see its value. A SimComponent can hold children SimComponents, and this can continue recursively. The only particular ability seems to be that each level of SimComponent has a console "namespace" (inherited from SimObject).
So you can have one object that has many namespaces. A call to console function will be intercepted by the first component that has that function. So if I define a console function hitEnemy(), and the main SimComponent or a child components in this tree has a hitEnemy() it will run. If there are more than one definition of hitEnemy() the first will run only. This is only possible from a console function. You cannot write C++ functions and get this ability.
SimComponents aren't named and don't have any other way to be categorized, mixed-in, or whatever.
It has one subclass that eventually leads to the subclass SceneObject. So somebody may use it in their custom code. However, no engine code uses SimComponent instances.
Finally, a Behavior is a different story. Those are documented and I use them all the time. (And they seem to do what a SimComponent does, but with more features.)
Any ideas to this guy? Is he a vestigial organ of some kind?
What it does (I think)
Reading the code, I can only barely see its value. A SimComponent can hold children SimComponents, and this can continue recursively. The only particular ability seems to be that each level of SimComponent has a console "namespace" (inherited from SimObject).
So you can have one object that has many namespaces. A call to console function will be intercepted by the first component that has that function. So if I define a console function hitEnemy(), and the main SimComponent or a child components in this tree has a hitEnemy() it will run. If there are more than one definition of hitEnemy() the first will run only. This is only possible from a console function. You cannot write C++ functions and get this ability.
SimComponents aren't named and don't have any other way to be categorized, mixed-in, or whatever.
It has one subclass that eventually leads to the subclass SceneObject. So somebody may use it in their custom code. However, no engine code uses SimComponent instances.
Finally, a Behavior is a different story. Those are documented and I use them all the time. (And they seem to do what a SimComponent does, but with more features.)
Any ideas to this guy? Is he a vestigial organ of some kind?
#2
05/28/2013 (8:07 am)
Behaviors are derived from SimComponent. This is an example of a base class that is never used as itself, only derived classes are ever actually instanciated. To make this clearer they should perhaps have documented it, or made it pure virtual. Since we all like Behaviors I highly discourage removing SimComponent - lol.
#3
but SimComponent ... if can support simSet..
08/01/2013 (2:14 am)
SceneObject and Scene support Behaviors, very usefull, I create many behaviors, like Fire, Move, Sensor, Act, Fader, etc..but SimComponent ... if can support simSet..
Torque Owner Lukas Joergensen
WinterLeaf Entertainment