Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Lime + PhysicsEditor - ReferencePoint Issues
Started by angryphase Apr 12 2012 03:56 AM

3 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

angryphase

[GLOBAL: userInfoPane.html]
angryphase
  • Observer

  • 17 posts
  • Corona SDK

Hi Guys,

I've been playing with Tiled, Lime and PhysicsEditor and come across a rather annoying little error that I can't seem to workaround.

I created a basic platformer-style level in Tiled and then used PhysicsEditor to construct the physics-related data (as per the tutorial/example).

This is what I'm seeing in hybrid drawing mode:



The code I'm using is as follows:
function scene:createScene( event )  local group = self.view    local map = lime.loadMap("levelone.tmx")  local visual = lime.createVisual(map)  group:insert(visual)    local physicsData = {}  local file = io.open( system.pathForFile("levelone.json", system.ResourceDirectory) )  if file then    local input = file:read( "*a" )    physicsData = json.decode(input)    io.close( file )  end    physics.addBody(map.world, "static", unpack(physicsData["levelone"]))  map.world.id = "map"    local sprite = display.newImage("sprite.png")  sprite.x = 50  sprite.y = 80  sprite.id = "sprite"  physics.addBody(sprite, "dynamic", unpack(physicsData["sprite"]))    group:insert(sprite)end


The static/platform image and physics is fine. It's just the 'sprite' that causes issues.

What's odd, is that if I replace the physics data with the direct values minus the 'shape' parameters from PhysicsEditor (on line 23), the reference point and alignment are correct.

Physics Data:
[text]
{

"levelone": [

{
"density": 2, "friction": 0, "bounce": 0,
"filter": { "categoryBits": 1, "maskBits": 65535 },
"shape": [ 0, 257 , 2, 256 , 217, 256 , 224, 261 , 224, 320 , 0, 320 ]
}
]

,
"sprite": [

{
"density": 2, "friction": 0, "bounce": 0,
"filter": { "categoryBits": 1, "maskBits": 65535 },
"shape": [ 0, 40 , 0, 0 , 25, 0 , 25, 40 ]
}
]

}
[/text]

Does anybody have the simple answer that's been eluding me? Guessing it's related to handling the setReferencePoint or similar, but I've had no success so far.

[Edit] Moved to TexturePacker forum, in case those familiar with PhysicsEditor and Corona can offer some guidance in what I'm doing wrong.
uid: 122384 topic_id: 24769 reply_id: 324769


[TOPIC: post.html]
#2

angryphase

[GLOBAL: userInfoPane.html]
angryphase
  • Observer

  • 17 posts
  • Corona SDK

Hi Guys,

I've been playing with Tiled, Lime and PhysicsEditor and come across a rather annoying little error that I can't seem to workaround.

I created a basic platformer-style level in Tiled and then used PhysicsEditor to construct the physics-related data (as per the tutorial/example).

This is what I'm seeing in hybrid drawing mode:



The code I'm using is as follows:
function scene:createScene( event )  local group = self.view    local map = lime.loadMap("levelone.tmx")  local visual = lime.createVisual(map)  group:insert(visual)    local physicsData = {}  local file = io.open( system.pathForFile("levelone.json", system.ResourceDirectory) )  if file then    local input = file:read( "*a" )    physicsData = json.decode(input)    io.close( file )  end    physics.addBody(map.world, "static", unpack(physicsData["levelone"]))  map.world.id = "map"    local sprite = display.newImage("sprite.png")  sprite.x = 50  sprite.y = 80  sprite.id = "sprite"  physics.addBody(sprite, "dynamic", unpack(physicsData["sprite"]))    group:insert(sprite)end


The static/platform image and physics is fine. It's just the 'sprite' that causes issues.

What's odd, is that if I replace the physics data with the direct values minus the 'shape' parameters from PhysicsEditor (on line 23), the reference point and alignment are correct.

Physics Data:
[text]
{

"levelone": [

{
"density": 2, "friction": 0, "bounce": 0,
"filter": { "categoryBits": 1, "maskBits": 65535 },
"shape": [ 0, 257 , 2, 256 , 217, 256 , 224, 261 , 224, 320 , 0, 320 ]
}
]

,
"sprite": [

{
"density": 2, "friction": 0, "bounce": 0,
"filter": { "categoryBits": 1, "maskBits": 65535 },
"shape": [ 0, 40 , 0, 0 , 25, 0 , 25, 40 ]
}
]

}
[/text]

Does anybody have the simple answer that's been eluding me? Guessing it's related to handling the setReferencePoint or similar, but I've had no success so far.

[Edit] Moved to TexturePacker forum, in case those familiar with PhysicsEditor and Corona can offer some guidance in what I'm doing wrong.
uid: 122384 topic_id: 24769 reply_id: 324769


[TOPIC: post.html]
#3

Glitch Games

[GLOBAL: userInfoPane.html]
Glitch Games
  • Contributor

  • 597 posts
  • Corona SDK

Are you able to send me a simplified reproducible demo to support AT glitchgames DOT co DOT uk and I will see if I can find a solution.
uid: 119420 topic_id: 24769 reply_id: 101378


[TOPIC: post.html]
#4

andreas.loew

[GLOBAL: userInfoPane.html]
andreas.loew
  • Enthusiast

  • 79 posts
  • Corona SDK

Are you using the "Lime + Corona (Lua)" exporter? This one seems to have the bug but it should be consistent with all sprites.

Try using the Corona exporter instead - this one should solve your problem.

If not it would be kind if you could send me the project to support at codeandweb.com
uid: 9611 topic_id: 24769 reply_id: 113720



[topic_controls]
[/topic_controls]