|
|
Tim Nikias v2.0 wrote:
> I've got following problem:
> For an algorithm to behave realistic, I need to know
> the speed an object has. Problem is, I only have the
> boundary-box accessible, and this one may change
> its size. The object is macro driven and may suddenly
> become something different, or just grow at certain
> places.
>
> Thinking about it, there is no error-proof method of
> getting the speed from that, is there?
>
> Hm. Perhaps I'll need to seperate object and its
> transformation, and just apply the transformation to
> a position. This'll give me the possibility of generating
> the speed...
If the object rotates, changes size or grows at certain points then
different parts of it will be moving at different speeds, which point do
you want to measure the speed of?
I assume from what you've written that there is some nominal 'centre' of
the object which is being translated by different amounts in different
frames, but that due to the structure of your code this translation
calculation and its results are inaccessable to your speed calculation.
Without seeing any code it is difficult to see what the problem is, but
it sounds as though the calculation that produces the transformation is
bundled up inside a whole lot of other code in a macro that generates
the object and positions it. In that case your last paragraph would seem
to be bang on target, your code is not modular enough, and needs to be
broken up into smaller logical units. Write a separate macro that does
nothing but spit out a vector describing the translation of the object
at a given moment, then call it from both the object generation code and
the speed calculation.
Post a reply to this message
|
|