Space#add_collision_handler(a, b, handler)
and pass any object that responds to begin, pre, post and/or sep. You don't need to use a particular class and you don't need to implement all the methods.Space#add_collision_func(a, b, type, &block)
and pass, say, &your_object.method(:handle_collision)
as the last parameter instead of a block.Arbiter
or the two colliding Shape
objects. The single argument form is preferred since the arbiter holds the two shapes plus additional collision information. Have a look at chipmunk-ffi/arbiter.rb
to see what exactly it offers.Proc
object) to the other method I mentioned, add_collision_func
.
Method
and Proc
objects are distinct, but you can convert a method to a proc easily. :) The nice thing is that the method stays bound to the object it belongs to, so you can pass it around and call it just like a proc and self will still be the original "owner" object.Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill