Initialising datablock values set by script
by Daniel Buckmaster · in Torque Game Engine · 08/05/2008 (12:58 am) · 1 replies
I know that in a datablock's constructor, there's an opportunity to set default values on all its members. So if something's not set by script, there's a sensible value in there instead of junk. However, where should I initialise values that have already been set by script?
The specific example is that I'm working on projectiles bouncing. I only want them to bounce if they hit a surface under a certain angle. The angle is a datablock property. To make it easy to use, I just make the user set an angle in degrees - but in-engine, I need to have the cosine of the angle, rather than the angle itself. Where is the best spot to perform a cosine on the angle, after it has been passed in script?
The specific example is that I'm working on projectiles bouncing. I only want them to bounce if they hit a surface under a certain angle. The angle is a datablock property. To make it easy to use, I just make the user set an angle in degrees - but in-engine, I need to have the cosine of the angle, rather than the angle itself. Where is the best spot to perform a cosine on the angle, after it has been passed in script?
About the author
Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!
Associate James Ford
Sickhead Games