Game Development Community

Loading Point3F classes from datablocks?

by Josh Albrecht · in Torque Game Engine · 03/16/2002 (7:41 am) · 1 replies

I need to load a Point3F class from the datablock into an array in the code.

Code:

//in player.cc, void PlayerData::initPersistFields()
   addField("HitMin", TypePoint3F, Offset(HitMin, PlayerData), MAX_BOXES);
   addField("HitMax", TypePoint3F, Offset(HitMax, PlayerData), MAX_BOXES);
//MAX_BOXES is a constant euqal to 20

//in the script file player.cs, inside the player datablock:
   HitMin[0] = "-0.1, -0.22, -0.22";
   HitMax[0] = "0.6, 0.22, 0.22";

Now, how I understand it, is that you declare your variable (in this case an array of Point3Fs) with addField, when the datablock is run, the variable is set equal to whatever values are in the datablock.

Problem: Only the first value (the x value) is read into HitMin and HitMax. So, the first value for HitMin[0] is read in, as is the first value for HitMin[1], but no y or z values are read in for either (they are set equal to zero, and they are NOT 0 in the datablock).

Does anyone have any clue what is going wrong here?
(btw: I dont want to send this data across the connection. There is no need for the client to have access to it).

#1
03/16/2002 (10:01 am)
I figured it out. I had

"4.0, 4.0, 4.0"

for the point values. It is supposed to be:

"4.0 4.0 4.0"

Stupid commas! :/