Game Development Community

setFieldValue Doesn't Update

by Greg G · in Torque 3D Professional · 10/24/2012 (6:05 pm) · 1 replies

I'm trying to set the wind direction on a ground cover object in script.

GroundCover.setFieldValue ("windDirection","0 0.5","");

This changes the value on the object, but it does nothing in the mission. In order to see the value take effect I have to open the mission editor and click on and then off the object. Then the settings are visisble in the mission.

Does anyone know what else I need to call in script to apply the update?

#1
10/25/2012 (12:45 am)
I had to add a console function for this:

GroundCover.cpp

DefineEngineMethod( GroundCover, applyChanges, void, (),,
                   "Apply a full network update of all fields to all clients."                   
                  )
{
   object->inspectPostApply();
}

and implemented like so:

new GroundCover(MyGrass) {
  ...
};

MyGrass.windTurbulenceFrequency=0.2;
MyGrass.windTurbulenceStrength=0.5;
MyGrass.applyChanges();

Not 100% sure if you need the engine change and to call applyChanges unless you need it networked...

Cheers