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?
All images dragged into scene come at same size
Re: All images dragged into scene come at same size
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 (28.77 KiB) Viewed 25900 times
Re: All images dragged into scene come at same size
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
This might be useful too: RUBE editor tutorial 14/17 - Editing images
Re: All images dragged into scene come at same size
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?
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 (38.24 KiB) Viewed 25887 times
Re: All images dragged into scene come at same size
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?
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 (153.76 KiB) Viewed 25878 times
Re: All images dragged into scene come at same size
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.
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
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
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
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.
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
Thank you! This is perfect!
Ps: I'm doing an importer RUBE to CitrusEngine (flash), perhaps you know if someone have already do this ?

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