How to change a SimObject in C++ and get the effects in script?
by Corin · in Torque Game Engine · 08/04/2005 (2:55 pm) · 5 replies
About the author
#2
08/05/2005 (2:20 am)
All objects have an ID number. I would suggest naming the object (using the overload of registerObject that takes a name IIRC) so you can easily access it (ie, by saying MyName.field).
#3
If you change a field that is registered via addField, it will always be in synch both for script and C++. ie,
All changes are instantaneous.
08/30/2005 (9:32 am)
Try waiting more than six hours for a response. Posting many times is not going make people wake up in th middle of the night and answer your questions.If you change a field that is registered via addField, it will always be in synch both for script and C++. ie,
MyObject::initPersistFields()
{
addField("someField", TypeF32, Offset(mSomeField, MyObject));
}
MyObject *foo = new MyObject();
foo->registerObject("bikeObject");
In Script:
bikeObject.someField = 10;
echo(BikeObject.someField);
In C++:
Con::printf("%f", foo->mSomeField;All changes are instantaneous.
#4
08/30/2005 (11:40 am)
It's best to do it in script.
#5
09/02/2005 (5:20 pm)
You should be stuffing events from the glove into the move manager so that it is networked properly. Having never worked with the P5 code, I don't know what it's doing now. :)
Associate Kyle Carter
2. Set values to field from C++ (ie, this->mCount = 12;)
3. Read values from script. (ie, echo(%this.count);)