Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

velocity_func receives nil for gravity #11

Open
erisdev opened this issue Jun 25, 2010 · 1 comment
Open

velocity_func receives nil for gravity #11

erisdev opened this issue Jun 25, 2010 · 1 comment
Assignees

Comments

@erisdev
Copy link
Contributor

erisdev commented Jun 25, 2010

Well, just what the title says. I tried implementing a custom velocity_func and discovered that chipmunk-ffi is passing me nil for the gravity parameter. Replacing Vect.by_value with CP_FLOAT, CP_FLOAT in the callback definition causes FFI to pass the vector as two float values and this works on OS X, but it's probably not portable.

@RavensKrag
Copy link

I am on Ubuntu linux, and I report a similar error. However, instead of getting nil, I receive a CP::Vect object. This does not have #struct defined, and thus generates an error.

/var/lib/gems/1.9.1/gems/chipmunk-ffi-1.1.0/lib/chipmunk-ffi/body.rb:193:in update_velocity': undefined methodstruct' for #CP::Vect:0x0000000334be00 (NoMethodError)
from /home/ravenskrag/Code/Source/eternity/Physics/Space.rb:10:in block in <class:Space>' from /var/lib/gems/1.9.1/gems/chipmunk-ffi-1.1.0/lib/chipmunk-ffi/body.rb:212:incall'
from /var/lib/gems/1.9.1/gems/chipmunk-ffi-1.1.0/lib/chipmunk-ffi/body.rb:212:in block in velocity_func=' from /var/lib/gems/1.9.1/gems/chipmunk-ffi-1.1.0/lib/chipmunk-ffi/space.rb:300:incall'
from /var/lib/gems/1.9.1/gems/chipmunk-ffi-1.1.0/lib/chipmunk-ffi/space.rb:300:in cpSpaceStep' from /var/lib/gems/1.9.1/gems/chipmunk-ffi-1.1.0/lib/chipmunk-ffi/space.rb:300:instep'
from /home/ravenskrag/Code/Source/eternity/Physics/Space.rb:118:in step' from ./init_game.rb:136:inupdate'
from ./init_game.rb:255:in show' from ./init_game.rb:255:in

'

@shawn42 shawn42 self-assigned this Feb 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants