chipmunk-rb / chipmunk-ffi

chipmunk ruby bindings using ffi
26 stars 6 forks source link

No max_force= method in PivotJoint #8

Closed utgarda closed 14 years ago

utgarda commented 14 years ago
Exception in thread "Animation Thread" ./simulation.rb:33:in `grab': undefined method `max_force=' for #<CP::PivotJoint:0x527a9c0f> (NoMethodError)
utgarda commented 14 years ago

Fixed by utgarda@35292bea73ac2e71c5149e450ab41191afd2ffb2 , maybe it can be prettified. But then goes the next issue - shawn42#9

philomory commented 14 years ago

Do you have any idea what's wrong with the code as it stands? With the gem version of chipmunk-1.1.0, what are results of CP::PivotJoint.instance_methods, CP::Constraint.instance_methods, and CP::PivotJoint.ancestors? I don't have JRuby 1.5, so, I can't test the same setup you have, but in 1.4 that code works fine for me (there are other problems in 1.4, but the max_force= code works as expected).

utgarda commented 14 years ago

With jruby@6b9608d59e547a64b5d550c1f0c46e1ff2da79fb and chipmunk-ffi 1.1.0 gem version from the gem repo:

jruby --version
jruby 1.5.0.dev (ruby 1.8.7 patchlevel 249) (2010-04-13 6b9608d) (OpenJDK 64-Bit Server VM 1.6.0_0) [amd64-java]
jirb --version irb 0.9.5(05/04/13) jirb -rubygems irb(main):001:0> require 'chipmunk-ffi' NoMethodError: undefined method struct_class' for #<FFI::StructByValue:CP::Vect> from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi/struct_accessor.rb:41:inresolve_type' from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi/struct_accessor.rb:21:in add_struct_reader' from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi/struct_accessor.rb:7:instruct_reader' from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi/struct_accessor.rb:7:in each' from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi/struct_accessor.rb:7:instruct_reader' from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi/struct_accessor.rb:16:in struct_accessor' from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi/constraints/pin_joint.rb:20 from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi/constraints/pin_joint.rb:31:inrequire' from .../site_ruby/1.8/rubygems/custom_require.rb:31:in require' from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi/constraint.rb:46 from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi/constraint.rb:31:inrequire' from .../site_ruby/1.8/rubygems/custom_require.rb:31:in require' from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi.rb:44 from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi.rb:43:ineach' from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi.rb:43 from .../chipmunk-ffi-1.1.0/lib/chipmunk-ffi.rb:36:in require' from .../site_ruby/1.8/rubygems/custom_require.rb:36:inrequire' I guess this makes the question irrelevant for now. Nope, I have no idea why adding max_force accessor doesn't work with jruby as it is, and why my fix does work. Both look ok to me. Actually, I still don't quite understand ruby modules and mix-ins.

shawn42 commented 14 years ago

As I am not actively using this with jruby, is this fixed or not?

utgarda commented 14 years ago

Now it works perfectly well as it is, no fixing needed.