About Monkey 2 › Forums › Monkey 2 Programming Help › Chipmunk queries
Tagged: chipmunk
This topic contains 20 replies, has 4 voices, and was last updated by 
 abakobo
 2 years, 2 months ago.
- 
		AuthorPosts
 - 
		
			
				
January 17, 2017 at 9:34 pm #6594
One thing I can probably do quite easily is wrap cpSpaceBBQuery so it accepts an mx2 function, allowing you to use it with methods, lambas etc.
January 17, 2017 at 10:06 pm #6596That’d be good
What is the risk of using a self referencing field in a class? I didn’t quite follow what you said on github?
January 17, 2017 at 10:45 pm #6597DOH! it was right there in front of me – how on earth did I miss the fact it was a local! very odd how printing it after creating it even had any effect….
January 18, 2017 at 10:05 pm #6626One thing I can probably do quite easily is wrap cpSpaceBBQuery so it accepts an mx2 function, allowing you to use it with methods, lambas etc.
I’m looking forward to see the mx2/C code for it. I really wonder how those things can be connected..
That is some bad news, my next step on playing with monkey was learning callbacks and continue some chipmunk demos..!
But this is something, chipmunk is using a lot of C type callbacks.If you show the way for wrapping these queries, I’m ready to manually do the others if you don’t have the intention to automate the process. But I can work on Sundays only for some months.
here is a (I think exhaustive) list of the callback function types, I didn’t count the queries using them..
[/crayon]Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344[crayon-5cb9cf7d9eaf4534734007 inline="true" ]'chipmunk_structs.hcpSpaceArbiterApplyImpulseFunc'cpBody.hcpBodyVelocityFunccpBodyPositionFunccpBodyShapeIteratorFunccpBodyConstraintIteratorFunccpBodyArbiterIteratorFunc'cpDampedSpring.hcpDampedSpringForceFunc'cpDampedRotarySpring.hcpDampedRotarySpringTorqueFunc'cpConstraint.hcpConstraintPreSolveFunccpConstraintPostSolveFunc'cpMarch.hcpMarchSampleFunccpMarchSegmentFunc'cpSpace.hcpCollisionBeginFunccpCollisionPreSolveFunccpCollisionPostSolveFunccpCollisionSeparateFunccpPostStepFunccpSpacePointQueryFunccpSpaceSegmentQueryFunccpSpaceBBQueryFunccpSpaceShapeQueryFunccpSpaceBodyIteratorFunccpSpaceShapeIteratorFunccpSpaceConstraintIteratorFunc'cpSpatialIndex.hcpSpatialIndexBBFunccpSpatialIndexIteratorFunccpSpatialIndexQueryFunccpSpatialIndexSegmentQueryFunccpBBTreeVelocityFuncJanuary 18, 2017 at 10:15 pm #6627I shouldnt worry once you have sussed out how one call back works in detail then any others are obvious !
You can always hold a c ptr in a class field, and an mx2 ptr in a c/c++ user data void pointer, if you c struct or c++ class doesnt have user data then you might add one or make a custom c++ class containing pointer to the c class and a void pointer for the mx2 ptr.
Id love to see the ability to link classes/structs with mx objects, object finalisers (onDestroy method) would be famtastic but the doesnt see much interest…
January 23, 2017 at 10:03 pm #6759added a working demo with BBquery with function Callback and UserDatas on my chipmunk_mx2 github repo. It’s not clean but readable I think. It’s a bit too big. I’ll probably start to make simpler examples because there’s to much shapes objects and that makes too much code lines. BUT it’s fully working!
https://github.com/abakobo/chipmunk_monkey2
 - 
		AuthorPosts
 
You must be logged in to reply to this topic.