It looks like you're new here. If you want to get involved, click one of these buttons!
recommend you watch this video at 0.25 playback speed
i setup a color change algorithm in the collision function, and i change colors based on contact.state, but the results seem to not be correct, the boxes should be green when contact.state is not ENDED and then back to blue/red when ENDED
function Body:collide(contact)
if self.body == contact.bodyA or self.body == contact.bodyB then
if contact.state == BEGAN or contact.state == CHANGED then
local col = Colors.green
self.demoMesh.mesh.shader.modColor = vec3(col.r/255, col.g/255, col.b/255)
elseif contact.state == ENDED then
local col = Colors[self.color]
self.demoMesh.mesh.shader.modColor = vec3(col.r/255, col.g/255, col.b/255)
end
end
end
Comments
Thanks, I've passed this report onto @John and he says it does look incorrect
@Simeon @John
i think this bug is on my side because i’m not keeping track of more than 1 collision, so if more than one occurs and just one of them ends, the body goes to the “off” color even if it’s still touching another body...
BUT i noticed that
CHANGED
is never true so that is another bugalso i noticed using
physics.continuous
creates a memory leakyou can test it out using this altered Simple Physics example, touch anywhere to create 100 bodies, then repeatedly press the MOVE button, you will see the memory monitor keeps increasing by small increments and never goes back down to the “starting” memory
@Simeon i have also noticed that there’s a bug with collision in that sometimes the ENDED event comes before the STARTED event
it’s caused me some headache trying to account for it, it happens often when there’s a lot of bodies (100+) OR when a collision is really fast (hit and run)
p.s. turn down your volume or you will get a preview of the music i listen to while coding
Collision Event order bug, fast
Codea collision bug, many