Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Scaling problem

Author
Message
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 7th Nov 2009 23:18 Edited at: 7th Nov 2009 23:20
Hi! I've been working on a level editor for about 2 days and now I'm adding the option to scale an object. This is the code I'm using:

I want to change the scale of the objects Y axis by adding/decreasing it whenever the user scrolls up/down with the mouse. Now if I remove the 2nd argument from this line:
float ScaleY = dbObjectSizeY ( SelectedObject, 1 );
The objects scale doesn't update it just keeps going back to it's original size. But when I add 1 to the 2nd argument (it's suppose to return the size of the object with the scale) the objects Y scale goes up to 5000000 or so. So how can I fix this? Thanks for any help!

Your bedtime story is scaring everyone
If found my very own Fail!: http://cheezburger.com/View.aspx?aid=2712171776
cleonjones
14
Years of Service
User Offline
Joined: 24th Oct 2009
Location:
Posted: 8th Nov 2009 05:34 Edited at: 8th Nov 2009 05:38
Why is ScaleY being set in the if loop? If you are scaling (IsScaling = true) then it will set the ScaleY to the object Y size as long as scaling is true. Just set that initially and the changes made to ScaleY should still reflect a change.

And also I don't see anywhere where it says it will return the size of the object with the scale, in my VC++ it just pops up saying iUseScaling? Also it doesn't mention that in the help file

?
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 8th Nov 2009 18:09
Well I could keep track of ScaleY through out the entire program but the problem is, is that it's a level editor so I would have to keep track of every Y scale of every object made by the user. Also I assumed that the iUseScaling means that it would use the change in scale, and the documentation hasn't been updated for a long time. But, I guess until I get this working right I could just keep track of every ScaleY value for every object in an array or something.

Your bedtime story is scaring everyone
If found my very own Fail!: http://cheezburger.com/View.aspx?aid=2712171776
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 8th Nov 2009 19:30 Edited at: 8th Nov 2009 19:32
Quote: "I assumed that the iUseScaling means that it would use the change in scale"


As far as my experience goes this is correct.
BUT: The problem here is that you refer to dbObjectSizeY and not the objects scale! The command you are using returns the objects size in the world measured in units, the scale is always entered as percentage of the objects original size (or its scaled size if you set the second parameter to 1).
I had this problem too when I was working on an editor.
You either need to keep track of the scale values for yourself by using an array or something, or you work just with sizes in units.
That's how I did it, and ended up with a SizeObject function.
Here's the code:



That way you don't have to deal with percentages at all and just give the function your desired object size.

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 8th Nov 2009 20:17
Ah ok I understand now Thanks for the function Pauli, works perfectly!

Your bedtime story is scaring everyone
If found my very own Fail!: http://cheezburger.com/View.aspx?aid=2712171776

Login to post a reply

Server time is: 2024-10-01 16:43:55
Your offset time is: 2024-10-01 16:43:55