Hi Everyone,
I’m trying to change the friction property of one element in a complex physics body (that represents the player character) on collision. What I have is much like what’s posted here: http://www.badlogicgames.com/wordpress/?p=2017
The problem I’m having is that I can’t get a reference to the particular element in the physics body so that I can change it’s attributes. The corona collision event gives me the index of that element ( event.selfElement ), but I can’t find the array of elements in my physics body anywhere.
Here’s the code that creates my body:
squareShape = { -15,-40, 15,-40, 15,45, -15,45 }
sensorShape = { -8,40, 8,40, 8,50, -8,50 }
physics.addBody(self.avatar,
{density = .5, friction = 0, bounce = 0, shape = squareShape},
{density = .5, friction = 0, bounce = 0, shape = sensorShape, radius = 10, isSensor = true}
)
How do I get a reference to “{density = .5, friction = 0, bounce = 0, shape = squareShape}” without storing a global reference somewhere? [import]uid: 135733 topic_id: 25084 reply_id: 325084[/import]