Game Development Community

SizeTo for t2dSceneObject

by Matthew "Ashteth" Kee · in Torque Game Builder · 02/02/2006 (12:42 pm) · 4 replies

Is it possible that we could get a "sizeTo" member for t2dSceneObject that would include functionality similar to moveTo and rotateTo but adjusts the object's width / height using a linear speed?

I was thinking of something like:
sizeTo(widthTarget, widthSpeed, heightTarget, heightSpeed, [autoStop?], [callback?], [snap?], [targetMargin])

Would be fairly useful.

#1
02/02/2006 (5:50 pm)
This is getting ridiculous at this point. We shouldn't have 20 "X-to" functions.

Instead, what we should have is a function that binds some kind of object to the scene object, and that object will, once each scene graph frame, perform some modification to the scene object. The object (a function plus arbitrary data) should be able to do pretty much anything it wants to the scene object. The object will decide when it is finished.

And, of course, you can bind multiple of these objects. And perhaps there should be some special-case defaults (linear move-to, etc) to cover simpler cases.
#2
02/02/2006 (7:14 pm)
I agree with your suggestion Smaug if it could be implemented well. That said, I believe the sizeTo() command would go along with the simple linear alterations that are currently in the engine. I didn't like the built in linear interpolation commands at first, but I've found that you can accomplish fairly complex behavior with these simple commands when combined with script callbacks. And while we're on the subject, I'd also like colorTo()... :) I recently implemented bezier curve following using only moveTo() and script callbacks, so I think the current system is fairly flexible and I like the fact that I can do everything in script.

If we're going to have some of the linear interpolations, it would be nice to have a more complete set. I'm re-examining my movement / color / size interpolation code and would like to know if the engine is going to have any "official" support for these issues before I implement the functions myself...
#3
02/02/2006 (11:57 pm)
Quote:If we're going to have some of the linear interpolations, it would be nice to have a more complete set.

Yeah, that's why I wanted to have one function rather than twenty that are all effectively doing the same thing to different variables. There are any number of parameters that one would want to interpolate, even linearly, and it's best to do it through a single API than adding 2 dozen functions to t2dSceneObject.
#4
02/03/2006 (12:08 am)
We definately want to take the approach of having interpolation without having to put in special code to do so each and every time; that's just nasty.

We gave way slightly with position/rotation because there was such an immediate need but even these will eventually be replaced with something better.

- Melv.