Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Ball colliding not with polygon created with polyline but with the outer rectangle which maps the polyline object
Started by IndieEnthusiast Nov 08 2018 11:17 AM

- - - - -
4 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

IndieEnthusiast

[GLOBAL: userInfoPane.html]
IndieEnthusiast
  • Contributor

  • 147 posts
  • Corona SDK

Can anyone please help me out with a collision issue?

 

I have a mountain, and I have added a polygon around it so that the exact shape can be mapped.

However when a ball is released, it does not collide with the lines rather it bounces off the rectangular shape. This is quite unfortunate. I thought the outline will serve as boundaries for the object layer, but it is not.

 

Here is the video : https://screencast-o-matic.com/watch/cFXjqXYRD7

 

my code is : 

local physics = require( "physics" )
-- Start the physics engine
physics
.start()
physics.setGravity( 0, 1 )
physics.setDrawMode( "hybrid" )

local berry = require( 'ldurniat.berry' )
local map = berry.new( 'map_scene/Level1.json', 'Assets' ) -- look for images in /scene/game/map/

local myCircle = display.newCircle( 400, 50, 15 )
myCircle:setFillColor( 0.1 )
physics.addBody( myCircle, "dynamic", {density=14.0, friction=0, bounce=0.2})

map:insert(myCircle)

The ball is not colliding with the outline of the polygon created, rather it is colliding on the outer rectangle within which the polyline object resides.

 

Is this a bug?



[TOPIC: post.html]
#2

IndieEnthusiast

[GLOBAL: userInfoPane.html]
IndieEnthusiast
  • Contributor

  • 147 posts
  • Corona SDK

Just to mention I am using :

- Tiled map editor 1.2

- Berry map loader latest edition

- Corona latest released version



[TOPIC: post.html]
#3

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,253 posts
  • Corona SDK

probably not a bug.  likely related to Berry's handling of adding bodies to the different object types editable in Tiled.

 

Look at the berry source and see what it is doing.  

 

PS - My guess is that Berry has a drawer for polylines, but perhaps not a body adding piece.  Instead it treats the polyline like a rectangle.


  • IndieEnthusiast likes this

[TOPIC: post.html]
#4

IndieEnthusiast

[GLOBAL: userInfoPane.html]
IndieEnthusiast
  • Contributor

  • 147 posts
  • Corona SDK

Thanks for your feedback. I have contacted Iduriat about this issue. In my eyes it is an "issue", since a polyline or a polygon should be treated as a polygon not a rectangle. This results in collision of bodies with the rectangle not the intended polygon object inside.



[TOPIC: post.html]
#5

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,253 posts
  • Corona SDK

You're welcome, but I want to be clear.  While you may fee like it is an bug, it isn't.

 

1. Not a Corona bug. You don't add bodies to lines and expect a form-fitting body.  This is a documented thing.

 

2. Berry is free.  If it doesn't support a feature you want, you can add it, ask the author to add it, or pay someone to add it.

 

At no point does this rise to being a bug.

 

PS - I'm not fond of the use bug or issue applied to mean, "doesn't do what I want/need." :(  (Issue being a euphemism for bug.)


  • IndieEnthusiast likes this


[topic_controls]
[/topic_controls]