Odd scaling behavior

Started by fireside, October 30, 2010, 04:19:33 AM

Previous topic - Next topic

fireside

I removed this because I found out why my extended class wasn't scaling using loadmodel.  Sorry for the post.
However, there does appear to be a speed increase using scalarMult() if an object is scaled up using setScale() after the model is built, so it seems to travel further using the same numbers, like twice as far if it's scaled up by 2.


click here->Fireside 7 Games<-

EgonOlsen

I'm not sure where the connection between scaling and skalarMul is....please give more details...

fireside

OK.  I have these characters and I needed to rescale them upward along with my map size.  At first using the scale on the loader function didn't work for me because I'm not that familiar with my own code and most of the loading was being done in another class.  Not thinking much about it, I used setScale(2) on the object after it was instantiated.
The way I was moving the characters was by translating the object with this code.

        SimpleVector d = ob.getZAxis();
        if (dMove > .5f) {
            d.scalarMul(.5f);
            ob.translate(d);
            dMove -= .5f;


I computed the distance to the next map point using a trig function, which is dMove in the above code, so it would reach a certain point  after so many screen draws.  However, after the scaling using setScale(2), the object moved twice as far as the computed distance.  When I then figured out why the loader wasn't working, and I loaded the model at a higher scale of 2 with the loader function, the distance traveled worked out right.

click here->Fireside 7 Games<-

EgonOlsen

Well, there's a good chance that get?Axis' results aren't normalized and that will cause the scaling to have an effect on them. I'll look at it when i'm back at home and correct that flaw if that is the case.

EgonOlsen

Yes, i can confirm this problem now. I'll fix it in the next release. Until then, you can simply normalize the results that get?Axis() gives.

fireside

It works fine if I scale with the loader function and I'm not rescaling other than that, or planning on it, so next release works great for me.
click here->Fireside 7 Games<-