physics editor issue

Hi,

I am using Physics Editor to define the shape of an object in corona.

The .lua file generated from the physics editor for an object is included like this:
local obj1ShapeData = (require “obj1”).physicsData()

And the body is added to physics engine like this:
physics.addBody( obj1, obj1ShapeData:get(“obj1_00001”) )

obj1_00001.png is my image file name

This code works fine, however i am not able to define other properties like sensor, filter on the object while adding to physics engine.

I used different ways to add the object as shown below, but in both cases it crashes the game:

  1. physics.addBody( obj1, { isSensor = true, filter = fenceObjectFilter, shape = obj1ShapeData:get(“obj1_00001”} )

2)1) physics.addBody( obj1, obj1ShapeData:get(“obj1_00001”, { isSensor = true, filter = fenceObjectFilter )

both methods does not work. Can anyone help me resolving this issue?
[import]uid: 10239 topic_id: 7042 reply_id: 307042[/import]

Please set the properties directly in PhysicsEditor.

All entries are found on the right side.

You can enter names for your collision bits and set/clear them bit by bit.

[import]uid: 9611 topic_id: 7042 reply_id: 24684[/import]

I gave up on Physics Editor. I love the idea but there isn’t enough documentation or instructions for it, no online tutorials (that I can find anyway), so I gave up and went back to doing things manually :frowning:

(If someone can point me to a video tutorial or something on it that would be excellent :slight_smile: ) [import]uid: 26706 topic_id: 7042 reply_id: 32244[/import]

What information would you need? How can I help you?

I thought the examples included should give you a good starting point…

[import]uid: 9611 topic_id: 7042 reply_id: 32246[/import]

The things are quite simple:

  1. Create a file containing your shapes, export for Corona as “shapedefs.lua”. You can see this in my teaser video

  2. Load the physics data file from your project code:

[lua]local physicsData = (require “shapedefs”).physicsData()[/lua]

  1. Create the shape/sprite - just like you would do when adding things manually

[lua]obj = display.newImage(“ball.png”);[/lua]

  1. Assign the shape from the shapedefs.lua file to your sprite

[lua]physics.addBody(ball, physicsData:get(“ball”))[/lua]

A complete demo code is included in the .dmg file (MacOS) or in the PhysicsEditor folder on windows.

[import]uid: 9611 topic_id: 7042 reply_id: 32248[/import]

Thank you so much for the response! Thats awesome :slight_smile:

The trouble I am running in to is I’m not sure what the following options do:

-Bit’s Name
-Cat.
-Mask

I’m not really sure what these options do or how I should tweak them.

I ended up figuring out the problems I was having after playing around a bit. I was running into trouble putting the code into my project (I still have no clue what went wrong, but after redoing the entire file it worked). I will also be buying your software :slight_smile: Its a HUGE convenience! Thank you for making it :slight_smile: [import]uid: 26706 topic_id: 7042 reply_id: 32252[/import]

Let’s begin with cat and mask. Both are the for collision detection. Look here:
http://developer.anscamobile.com/content/game-edition-collision-detection

cat = categoryBits
mask = maskBits

The bits are just for convenience allowing you to set them by clicking instead of using the complete value.

You can change the bit’s name to make it easier for you to know which bits to set. This is not (yet) exported - it just stays in the *.pes file.

E.g. you can name bit 0 “ground”, bit 1 “ball”.

For a ground shape you check the ground-bit (0) and for the ball the ball-bit (1) in Cat.

If you want them to collide with each other you check the ball-bit in ground and ground-bit on the balls maskBits.

If you want the balls to collide with other balls you also check the ball-bit on you ball shapes.

ball:
cat = 0002
mask = 0003

ground:
cat = 0001
mask = 0002
[import]uid: 9611 topic_id: 7042 reply_id: 32257[/import]

Thanks so much for the explanation :slight_smile: (I’m not sure why it didn’t click earlier). I’m now a happy owner of Physics Editor :slight_smile: [import]uid: 26706 topic_id: 7042 reply_id: 32258[/import]

How would you use the editor for an animation/movieclip? [import]uid: 40538 topic_id: 7042 reply_id: 32886[/import]