Editing physics shapes with ease

@smloh: Can you please send me the .pes file so I can have a look what’s going wrong with the comma? => support at code-and-web.de

Are you deleting the point by doubleclicking it or by right mousebutton? [import]uid: 9611 topic_id: 6327 reply_id: 23838[/import]

Hi,

I updated PhysicsEditor to 1.0.1:

  • New: Press space to drag the shape in zoom mode

  • New: Undo

  • New: Flip

  • New: Rotate

  • New: Listview: Icons and sorting

  • New: IsSensor for corona

  • New: Added scale factor to corona (loading parameter)

  • Fix: Loading by clicking on icon reuses window

  • Fix: Exporter for corona had a missing comma when one body had multiple fixtures

  • Fix: Delete points from a 3 point polygon

Using the new scale factor during loading:

local scaleFactor = 1.0  
local physicsData = (require "shapedefs").physicsData(scaleFactor)  
local shape = display.newImage("objectname.png")  
physics.addBody( shape, physicsData:get("objectname") )  

Cheers
Andreas
[import]uid: 9611 topic_id: 6327 reply_id: 24179[/import]

I just tried PhysicsEditor and I must say that I was very impressed by it. A really useful tool! [import]uid: 13180 topic_id: 6327 reply_id: 29731[/import]

Hey Andreas :smiley:

Good to see you here in Corona forum. As a user of texture packer and physics editor. I would like to tell all corona suers that these two products are life saver!!! I love TP and PE and currently using them on my projects. IMO, TP is so much better than zwoptex… :smiley:

People go buy them!!! :slight_smile: [import]uid: 13978 topic_id: 6327 reply_id: 30094[/import]

Well thanks for the feedback!

Starting end of april i’ll be working fulltime (8-10h/day) to make PhysicsEditor and TexturePacker the best tools out there :wink:

Next stage: Compound object editor and complete level editor!
[import]uid: 9611 topic_id: 6327 reply_id: 30104[/import]

Thats awesome!

Compound object and level editor? o.O;; That would be awesome! My other cocos2d project is using PE to create the level which is anywhere from 50-100 point polygon as main level and additional polygons defined as sensors and in different filter group for distinction. It is working so far so good!

I left a support message on your website regarding an error on GB2ShapeCache.mm where you parse the plist and set the “isSensor”. The keyword should also read “isSensor”.

cheers!
[import]uid: 13978 topic_id: 6327 reply_id: 30173[/import]

That is awesome to hear Andreas, love your products. I would love to have that polyline thing we talked about a few weeks back. Your products are top notch and a must to have.

I will support!!! [import]uid: 8192 topic_id: 6327 reply_id: 30339[/import]

Andreas,
Be able to set if an object is static, kinematic or dynamic within PE would be nice. I’m using 1.0.0.2221.

Does PE and TexturePacker work together?

I just started exploring PE but have never tried how to use them together, do you have an example for that?

Would be nice to see how to do that properly. [import]uid: 13560 topic_id: 6327 reply_id: 30557[/import]

I’ll add support for object type as soon as possible. It’s not yet implemented.

Until than you should be able to set the body type by using
myBody.bodyType = “kinematic”

Importing from TexturePacker will be added with the next update.
I need to change some things to add suport for efficiently handling animations.

For now simply add the same sprites you use with TexturePacker to PhysicsEditor.
[import]uid: 9611 topic_id: 6327 reply_id: 30576[/import]

Andreas, This is awesome news. Can’t wait for Physics Editor and Texture Packer to work smoothly together.

Thanks [import]uid: 8192 topic_id: 6327 reply_id: 30583[/import]

@lano78 - Dude PE is fixture data editor… Its not meant to edit b2body settings. Besides it aint that hard to set body type in your code. Take it like a man and add the one extra line of code… -.-;;

And yeah I am flaming you because its something that you can do in one line of code and you are asking Andreas to do it for your lazy butt.

By the way, TP and PE are separate product… why is there need to work together? Spritesheet in PE? You do realize it will introduce new complexity to the coding of PE for adreaas? One other thing, you do realize that if you update any images on spritesheet you have to start with single image anyways. Single images for shape editing makes more sense rather than whole bunch of shapes that Andreas has to work to extract to edit the images… You create a single image, create shape data in PE, create a spritesheet in TP using the single images. What more do you want?

[import]uid: 13978 topic_id: 6327 reply_id: 30602[/import]

Very good points. I like the set-up as it is now too between the two. I wish PE would do very large graphics and multiple object detection. This way I could design a whole level, import it in PE to get the physical body and then use Tiled and lime to tile it out and use it in Corona.

This would be amazing. [import]uid: 8192 topic_id: 6327 reply_id: 30615[/import]

@aiden1004: Well - the idea for the TexturePacker-Integration is not to simply add all sprites but to select sprites from a sheet. PhysicsEditor.de will be able to detect animations perform an “AND” or “OR” operation on the animation’s polygons.
E.g. if you have a character with animated hair this will not be part of the resulting collision polygon if it’s animated whereas the body is.

@amigoni: In the current version PhysicsEditor is more a ShapeEditor. As I already said am currently planning the 2.0 update which will add creating compound objects (using the simple shapes you can create now and adding joints), realtime testing in the editor and level editing capabilities…
[import]uid: 9611 topic_id: 6327 reply_id: 30672[/import]

@andreas - Yeah I understand the concept but my argument is since we are starting with single images to make sprite sheet in TP anyways, why bother? It is just as easier to select the image you need to create shape in Finder and just drag and drop to PE. It just seems waste of your precious time when you can work on enhancements such as compound objects. As a developer myself, it frustrates me to see some people want features based on their need and opinions without having a full understanding of what is involved and how to do the work themselves.

Enough flaming these kind of people. Thank you for clearing things up and I love your products :smiley: [import]uid: 13978 topic_id: 6327 reply_id: 30681[/import]

@aiden1004

I’m not lazy, it is easy to add that one line of code but that was a suggestion for improvement. I’ve been using TP since the early days of when he made it public for Cocos2d and the same goes for PE, I’m sure he want his users to give him feedback on what they like to be able to do with these tools. [import]uid: 13560 topic_id: 6327 reply_id: 30682[/import]

@lano78

Thats not an improvement. I am sure Andreas wants feedback from his users, but feedback that actually is useful. If you have been using cocos2d, you should know that you have to create a b2body first and do following:

body->SetType(b2_dynamicBody);
[[GB2ShapeCache sharedShapeCache] addFixturesToBody:body forShapeName:@“planet02”];
[self setAnchorPoint:[[GB2ShapeCache sharedShapeCache] anchorPointForShape:@“planet02”]];

What more do you want to improve? Think about that. Wow really you want the author to improve the PE so you don’t have to type body->SetType(b2_dynamicBody); ? Is that really an improvement?
[import]uid: 13978 topic_id: 6327 reply_id: 30710[/import]

I released

I really like this application. It really helped me with my game. I only have one problem. My game involved Linear Impulses and once I imported that file and edited my other file, the impulses stopped working. Why is that? If you need code let me know [import]uid: 63298 topic_id: 6327 reply_id: 38566[/import]

Hi,

Is it possible to use physics editor with an animated spritesheet?

I’ve had a go and the hitbox is juts one frame, which does not change as my spritesheet animates.

How would I go about this?

Thanks! [import]uid: 50154 topic_id: 6327 reply_id: 41354[/import]

You can use it with animated shapes. But you should not add a physics shape for every animation frame. This would cause the physics simulation to behave strange.

PhysicsEditor has 2 special trace modes for animations:
intersection which is an AND operation over the polygons
union which is an OR operation over the polygons

You can add animation frames to a shape by pressing the “+” in the image parameters on the right pane in the main window. In the drop box you can select one shape to display - you can also verify your results here.

If you now start tracing (magic wand) you can select the frame mode. If you use the slider “Animation phase” you can check different phases of the animation and how they fit the shape. [import]uid: 9611 topic_id: 6327 reply_id: 41368[/import]