How best to do this in a script?
by Drethon · in Torque Game Builder · 05/11/2009 (9:45 am) · 1 replies
I want to create a PID controller to be used by any AI flying behaviors (patrol, pursuit, etc). A PID controller requires persistent data for the integration sum and previous error value for a derivative component.
As far as I can tell I cannot create a new class in the script, I could create a datablock to base the PID around but in trying to create a new instance of such a datablock I got an error cannot create a new object that is not a conobject or something like that so I don't fully understand datablock instances yet.
If I create an object from an existing class, can I create new instances of this object?
Sorry for a less than clear question, the concepts are still fuzzy in my head.
As far as I can tell I cannot create a new class in the script, I could create a datablock to base the PID around but in trying to create a new instance of such a datablock I got an error cannot create a new object that is not a conobject or something like that so I don't fully understand datablock instances yet.
If I create an object from an existing class, can I create new instances of this object?
Sorry for a less than clear question, the concepts are still fuzzy in my head.
Torque 3D Owner Drethon
Default Studio Name
function newFunction( ..parameters... ) { %object = new ScriptObject() { class = class; fields = ... ; }; return %object; }