Author Topic: Odd scaling behavior  (Read 1794 times)

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Odd scaling behavior
« on: October 30, 2010, 04:19:33 am »
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.


« Last Edit: October 30, 2010, 04:32:59 am by fireside »
click here->Fireside 7 Games<-

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Odd scaling behavior
« Reply #1 on: October 30, 2010, 02:35:09 pm »
I'm not sure where the connection between scaling and skalarMul is....please give more details...

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Re: Odd scaling behavior
« Reply #2 on: October 30, 2010, 04:07:46 pm »
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.
Code: [Select]
        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<-

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Odd scaling behavior
« Reply #3 on: October 30, 2010, 08:23:57 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Odd scaling behavior
« Reply #4 on: November 01, 2010, 10:05:21 pm »
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.

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Re: Odd scaling behavior
« Reply #5 on: November 02, 2010, 07:42:15 pm »
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<-