RUBE Loader Project

  ... the case you feel the need for a new feature or want to submit one.

Re: RUBE Loader Project

Postby shefchenko » Fri Oct 18, 2013 7:28 pm

Can I ask something :) ,
is there any way to get vertices from body(from all its fixtures) for making chain shape, of course body is from RUBE editor?I try to iterate over the fixtures to get their vertices but without success.
Image
User avatar
shefchenko
 
Posts: 23
Joined: Sat Jul 20, 2013 2:41 pm

Re: RUBE Loader Project

Postby nazgee » Fri Oct 18, 2013 8:04 pm

If you have chain fixture (it's called loop in RUBE editor), then you have no problems, because this type of fixture can have unlimited number of vertices, which already are in correct order.

Unfortunately, dynamic bodies ususually tend to be polygon fixtures. And as you porobably know polygon fixtures have limited number of vertices. This means that for complex polygon shapes RUBE creates multiple polygon fixtures, and this is where your porblem comes from, right?

I have found one solution: iterate over fixtures and convert them to MyPolygon objects. Then, take a union of these objects (that is- merge them) to create huge MyPolygon object, which will have duplicate vertices removed, and ordered correctly. This object is what you wanted, right?

Unfortunately library I use to get this effect is a little bugy, and it sometimes fucks up polygons... And no, it is not available from the AndEngineRubeLoaderExtension. Sorry...
Dirt Rider Mayhem is PUBLISHED now!
Image
User avatar
nazgee
 
Posts: 527
Joined: Fri Oct 21, 2011 10:31 pm
Location: Poland, Wrocław

Re: RUBE Loader Project

Postby shefchenko » Fri Oct 18, 2013 8:25 pm

nazgee wrote:If you have chain fixture (it's called loop in RUBE editor), then you have no problems, because this type of fixture can have unlimited number of vertices, which already are in correct order.

Yee I think that this is my solution, I just want them for making the ground, the body will be static.I will try this right now.

nazgee wrote:Unfortunately, dynamic bodies ususually tend to be polygon fixtures. And as you porobably know polygon fixtures have limited number of vertices. This means that for complex polygon shapes RUBE creates multiple polygon fixtures, and this is where your porblem comes from, right?

Yes, I know that poly fixture should have max 8 vertices, and that was my problem, but I think with these loop fixtures which you say - my problem will be resolved.

nazgee wrote:I have found one solution: iterate over fixtures and convert them to MyPolygon objects. Then, take a union of these objects (that is- merge them) to create huge MyPolygon object, which will have duplicate vertices removed, and ordered correctly. This object is what you wanted, right?

This sounds great solution for dynamic bodies, but I think that in my situation no need from this.

Thank you for quick answer :)
Image
User avatar
shefchenko
 
Posts: 23
Joined: Sat Jul 20, 2013 2:41 pm

Re: RUBE Loader Project

Postby Coder_For_Life22 » Sun Oct 27, 2013 7:02 am

@Nazgee, how do you go about loading animated sprites and textures?
User avatar
Coder_For_Life22
 
Posts: 1036
Joined: Wed Nov 09, 2011 5:37 pm

Re: RUBE Loader Project

Postby Coder_For_Life22 » Sun Oct 27, 2013 8:21 am

Quick dirty solution i came up with..

Supply a body at the position you would like the body in the real level. When game loads, find the specific body needed and get the position of it. Set it to the animated sprite. Then destroy that body, and create another body around that sprite and register it to the physics world.
User avatar
Coder_For_Life22
 
Posts: 1036
Joined: Wed Nov 09, 2011 5:37 pm

Re: RUBE Loader Project

Postby nazgee » Sun Oct 27, 2013 1:20 pm

You could have created a body without an image, find it via rubeloader, register physicsconnector to this body and newly created animated sprite, and be happpy. I do not understand why you had to destroy, and then recreate a body :)

If you're hardcore lover: all problems like that can be solved with factory objects I provided (yes, I had simillar problems- this is why this objects are there).

so start with
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public static class MyEntityFactory extends EntityFactory {
Parsed in 0.010 seconds, using GeSHi 1.0.8.4

and then create a RubeLoader like that:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. loader = new RubeLoader(new MyEntityFactory())
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


This way ALL rube images will be created by your implementation of EntityFactory.

Have a look at the following methods from original limplementation of this factory:
- createSprite() - creates a regular sprite from a given texture. If you want to do it your way, just override this method
- produce and produceImpl - they are both pretty messy, but are a good place to create your animated sprites

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. @Override
  2. public IEntity produce(PhysicsWorld pWorld, ImageDef image, AutocastMap pAutocastMap) {
  3.   if (needToBeAnimated()) {
  4.     myMethodToProduceAnimatedSprite(pWorld, image, pAutocastMap);
  5.   } else {
  6.      super.produce(pWorld, image, pAutocastMap);
  7.   }
  8. }
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


I'll try to prepare a valid tutorial on rube, but right now... you are like alpha testers of rube loader :)
Dirt Rider Mayhem is PUBLISHED now!
Image
User avatar
nazgee
 
Posts: 527
Joined: Fri Oct 21, 2011 10:31 pm
Location: Poland, Wrocław

Re: RUBE Loader Project

Postby shefchenko » Sun Oct 27, 2013 3:02 pm

nazgee wrote:You could have created a body without an image, find it via rubeloader, register physicsconnector to this body and newly created animated sprite, and be happpy.

I'm loading animated sprites exactly like that :)
I want to share some info that I found ->
-Motor joint doesn't exist in andengine.
-Weld joint with specified frequency and damping ratio also doesn't exist.
Just in case if you make these joints with RUBE, to not wonder like me. :)
Image
User avatar
shefchenko
 
Posts: 23
Joined: Sat Jul 20, 2013 2:41 pm

Re: RUBE Loader Project

Postby nazgee » Mon Nov 04, 2013 11:42 pm

Help needed: I have received 2 emails from 2 separate people claiming they see the same issue with this extension: that there is an offset of width/2 offset for objects+images imported by RUBE. Anyone seen it? Anyone not seeing it?
Dirt Rider Mayhem is PUBLISHED now!
Image
User avatar
nazgee
 
Posts: 527
Joined: Fri Oct 21, 2011 10:31 pm
Location: Poland, Wrocław

Re: RUBE Loader Project

Postby shefchenko » Sun Nov 17, 2013 12:47 am

nazgee wrote:Help needed: I have received 2 emails from 2 separate people claiming they see the same issue with this extension: that there is an offset of width/2 offset for objects+images imported by RUBE. Anyone seen it? Anyone not seeing it?


Sorry, I don't have this issue, when I import bodies from RUBE everything is on place. The loader is perfect :)
Image
User avatar
shefchenko
 
Posts: 23
Joined: Sat Jul 20, 2013 2:41 pm

Re: RUBE Loader Project

Postby nazgee » Sun Nov 17, 2013 6:42 pm

Thank! False alarm- they have been using gles2 AE branch, instead of AC.
Dirt Rider Mayhem is PUBLISHED now!
Image
User avatar
nazgee
 
Posts: 527
Joined: Fri Oct 21, 2011 10:31 pm
Location: Poland, Wrocław

PreviousNext

Return to Features

Who is online

Users browsing this forum: No registered users and 5 guests