Page 1 of 3

All images dragged into scene come at same size

Posted: Mon May 27, 2013 2:46 pm
by Eddy8555
I'm building bodies around some complex images (like a car) and running into a weird issue: all the images, when dragged onto a Rube scene, show up at the same size -- although they have entirely different sizes. This happens both on my Windows, and Mac OS machines.

When I use the vertex tool to build the shape, and export the scene, some of the bodies do not match the images -- they are either larger, or smaller. (Needless to say I'm using the same PTM_RATIO throughout the project.)

Why is this happening?

Re: All images dragged into scene come at same size

Posted: Mon May 27, 2013 2:54 pm
by Eddy8555
I'm attaching a screenshot with an example of images & bodies drawn with Box2D's debug draw on the xCode simulator. Notice especially the small body next to the much larger grass image.

Re: All images dragged into scene come at same size

Posted: Mon May 27, 2013 9:47 pm
by iforce2d
Did you take a look at the sample code as I suggested here?

This might be useful too: RUBE editor tutorial 14/17 - Editing images

Re: All images dragged into scene come at same size

Posted: Tue May 28, 2013 8:49 am
by Eddy8555
Thank's very much, iforce. The first 2 minutes of the tutorial, with the knowledge that Rube scales the images to 1 height unit was all I needed. And I will look at the code in the cocos2d sample project, but I've been bogged down by moving from Android to IOS (realizing it's probably a better platform for initial development of this project) and learning so many new things (C++, etc...)

Could you take a look at the attached image? The bodies and sprites now match in size, but are slightly misaligned. Why is this happening?

Re: All images dragged into scene come at same size

Posted: Wed May 29, 2013 6:46 am
by Eddy8555
Well, I'm guessing the issue is that the image's "x" in Rube -- as we can see in the screenshot -- isn't aligned directly with the center of the image itself. I also noticed a similar behavior with another image. Can anyone confirm it?

Is there a solution within Rube, or do I need to design my images so that they're centered inside a rectangle?

Re: All images dragged into scene come at same size

Posted: Wed May 29, 2013 7:10 am
by iforce2d
Did you take a look at the sample code as I suggested here?

For images attached to a body, you will need to take into account the position of the body, and the position of the image relative to that body.

Re: All images dragged into scene come at same size

Posted: Fri May 31, 2013 8:10 am
by toojee
I have the same problem, I would like create my entire level with rube and images but I need to conserve the scale between images! I watch the video but you resize the tire without any precision...
But I don't speak english, so maybe I don't understand very well the concept. I think I can use scale factor in my program to match the right size, but how I can find this scale factor? And how I can retrieve scale between images in rube?

Ps: i use flash and starling to create my level

Re: All images dragged into scene come at same size

Posted: Fri May 31, 2013 4:41 pm
by iforce2d
Perhaps this thread might be useful: viewtopic.php?f=7&t=40

The next update will most likely include a feature to run a script like that automatically every time you add an image to the scene.

Re: All images dragged into scene come at same size

Posted: Fri May 31, 2013 6:00 pm
by toojee
Thank you! This is perfect! :D

Ps: I'm doing an importer RUBE to CitrusEngine (flash), perhaps you know if someone have already do this ?

Re: All images dragged into scene come at same size

Posted: Sat Jun 01, 2013 1:47 am
by iforce2d
No, there is nothing specific for Citrus that I know of. For flash in general, this might be relevant: http://www.emanueleferonato.com/2012/12 ... -projects/