Datablocks
by Joiey Seeley · in Technical Issues · 10/07/2003 (10:09 pm) · 3 replies
Can anyone explain to me how the datablocks work? I don't understand them at all. At first I thought they were the equivalent of a class, but it doesn't seem to work like that.
About the author
#2
eg, I have a datablock for a projectile,
They basically describe the 'type' of object you are creating, ie the type of projectile. It is still a projectile and uses the same code as every other projectile, but the actual variable values are different.
eg to make a projectile I do
Well, thats my understanding of it, I could be wrong.
Hope that helps ;)
10/07/2003 (10:23 pm)
Datablocks hold data that you plug into an object when you create it.eg, I have a datablock for a projectile,
datablock ProjectileData(MyProjectile){
... a bunch of variables describing this type of projectile
such as the model to use, the velocity, damage, etc
}They basically describe the 'type' of object you are creating, ie the type of projectile. It is still a projectile and uses the same code as every other projectile, but the actual variable values are different.
eg to make a projectile I do
new Projectile(){
dataBlock = MyProjectile; //This tells the engine to load in all the variables defined in the MyProjectile datablock
.... other variables such as position etc
}Well, thats my understanding of it, I could be wrong.
Hope that helps ;)
#3
Thanks for the help so far.
10/08/2003 (8:48 am)
Let me see if I understand this correctly. Datablocks are totally seperate from classes. They are basically object descriptions that can be attached to instances of a class. This is a sort of different to initialize objects with unique characteristics as opposed to deriving a new class for every slightly different object. Am I understanding this correctly? Also, are there any other commonly used programming languages that use a similar concept?Thanks for the help so far.
Torque Owner Ben Swanson