I want to add multiple shapes to a physics object, that will have a varying number of facets.
For example, the object could be a star with a variable number of sides/points.
How do I dynamically create the physics detection shape for this?
with an object with a finite number of shapes (e.g 3) you can easily do:
physics.addBody( myStar, “static”,
{ density = 5, friction = 0.1, bounce = 0.6, shape={ 10,10,100,100 etc} }
{ density = 5, friction = 0.1, bounce = 0.6, shape={ 20,10,200,100 etc} }
{ density = 5, friction = 0.1, bounce = 0.6, shape={ 30,10,50,100 etc} }
)
but if the number of shapes is not known and will vary, how do I do it?
basically , this bit needs to repeat or be generated for each part.
{ density = 5, friction = 0.1, bounce = 0.6, shape={ 10,10,100,100 etc} }
I’ve tried various ways but not sure how to do this.
for next loop, concat string, another table etc, etc
Any ideas?
thx [import]uid: 49842 topic_id: 11321 reply_id: 311321[/import]