All images dragged into scene come at same size

General discussion about the R.U.B.E editor
Eddy8555
Posts: 42
Joined: Sat Apr 27, 2013 3:01 pm

All images dragged into scene come at same size

Post 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?
Eddy8555
Posts: 42
Joined: Sat Apr 27, 2013 3:01 pm

Re: All images dragged into scene come at same size

Post 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.
Attachments
bodies not same size.png
bodies not same size.png (28.77 KiB) Viewed 15155 times
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: All images dragged into scene come at same size

Post 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
Eddy8555
Posts: 42
Joined: Sat Apr 27, 2013 3:01 pm

Re: All images dragged into scene come at same size

Post 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?
Attachments
body sprite not aligned.png
body sprite not aligned.png (38.24 KiB) Viewed 15142 times
Eddy8555
Posts: 42
Joined: Sat Apr 27, 2013 3:01 pm

Re: All images dragged into scene come at same size

Post 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?
Attachments
image x not centered.jpg
image x not centered.jpg (153.76 KiB) Viewed 15133 times
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: All images dragged into scene come at same size

Post 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.
toojee
Posts: 9
Joined: Fri May 31, 2013 7:56 am

Re: All images dragged into scene come at same size

Post 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
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: All images dragged into scene come at same size

Post 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.
toojee
Posts: 9
Joined: Fri May 31, 2013 7:56 am

Re: All images dragged into scene come at same size

Post 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 ?
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: All images dragged into scene come at same size

Post 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/
Post Reply