Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

When putting a group with an object and physics body to dusk layer = problem!
Started by c.noeth Sep 27 2016 01:10 AM

1 reply 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

c.noeth

[GLOBAL: userInfoPane.html]
c.noeth
  • Contributor

  • 217 posts
  • Corona SDK

I am creating a group containing objects with physics bodies. Then I add this group to a dusk layer.

When I now look at my game screen the objects are off to the physics bodies.

When I'm not putting the group into the layer everything works fine.

 

My layer setup was made using the Tiled map editor and I'm using xParallax=1,yParallax=0 for this layer.

 

Any idea what is causing this and how to fix it?

 

Also moving the layer will only move the object (image) but not the physics body.

 

I'm also using the map.setCameraFocus(gfx.camfocusobj) to a helper object.



[TOPIC: post.html]
#2

Caleb P

[GLOBAL: userInfoPane.html]
Caleb P
  • Corona Geek

  • 1,424 posts
  • Corona SDK

This is actually a limitation of Corona itself and not Dusk. Physics objects in groups keep world coordinates instead of being local to the position of the group. To fix this, you'll need to either insert each object separately or use a multi-element physics body instead.

 

- Caleb




[topic_controls]
[/topic_controls]