Rube image x

General discussion about the R.U.B.E editor
Post Reply
Rogerboy
Posts: 9
Joined: Thu Aug 29, 2013 11:18 pm

Rube image x

Post by Rogerboy »

So the images in rube have a height in world units which is for example 20 but what about the width in world units? how am I supposed to work this out? I cant figure out anything, for example images.json has the background image as height 20 and aspect 1, there does not seem to be a width variable.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Rube image x

Post by iforce2d »

The width will depend on the dimensions of the image file. As an example, suppose the image file is 100 pixels wide, and 50 pixels high. This is an aspect ratio of 2:1, let's call this the 'natural' aspect ratio of the image.

If the image in the scene has a height in world units of 20 as you mention, then the width in world units would be 40, to keep the image at its natural aspect ratio of 2:1.

The 'aspectScale' property is not commonly used, but it allows you to stretch or squash the image, by adjusting the aspect ratio. For example, an aspectScale value of 2 would stretch the image to twice the normal width. For the example above, instead of using the natural ratio of 2:1 you would use 4:1 and the width of the image in world units would be 80.
Rogerboy
Posts: 9
Joined: Thu Aug 29, 2013 11:18 pm

Re: Rube image x

Post by Rogerboy »

Thanks I understand it now,
To anyone wondering how to do this: http://www.digitalrebellion.com/webapps ... _calc.html
Get the ratio and times it by the height units.
Post Reply