About Monkey 2 › Forums › Monkey 2 Development › New chipmunk 2d module issues
This topic contains 3 replies, has 2 voices, and was last updated by
Mark Sibly
2 years, 5 months ago.
-
AuthorPosts
-
November 4, 2016 at 2:12 pm #4773
Looks like some extern functions are note recognised anymore.
At least cpPolyShapeNew wich was working before..
a hellochipmunk.monkey2 with a polygon is attached
What is strange is that I can see its definition in chipmunk_extern.monkey2 so I don’t know what to do.AND..
I’m having a crash at the doccing phase on the chipmunk docs[/crayon]Monkey12345678910111213141516171819202122[crayon-5cba8d8c03a27772769398 inline="true" ]ildv1.0.91/windows_release/launcher.exe1 file(s) copied.Mx2cc version 1.0.91***** Doccing module 'monkey' *****Parsing...Semanting...***** Doccing module 'libc' *****Parsing...Semanting...***** Doccing module 'chipmunk' *****Parsing...Semanting...Caught signal:Memory access violationC:\Users\myname\Desktop\monkey2-chip4\scripts>Attachments:
November 4, 2016 at 8:24 pm #4778Oops, forgot to add these. Try latest master.
The module doesn’t actually use chipmunk_extern.monkey2 any more, it’s really just there for reference.
I’ve manually copied bits from this into body.monkey2, shape.monkey2 etc, so it’s possible I’ve missed more.
November 6, 2016 at 4:22 pm #4814had a try…
the polyshape funcs definitions in shape.monkey2 still had cpBody Ptr as argument so I replaced them with cpBody..
but polys are not showing!
In debug Mode I get the following error (a small notice window) (w7&w10):
MSV C++ Runtime lib.:
This application has requested the runtime to terminate it in an usual wayIn release mode it’s running but I can’t see the polygon (that I was seeing using the previous “unmodified” chipmunk module with just the “const” hack)
I just added this code to the hellochipmunk (after circle init):
[/crayon]Monkey12345678910111213141516[crayon-5cba8d8c09f3e893717444 inline="true" ] '--- A Pentagonmass = 0.3Local NUM_VERTS := 5Local verts:=New cpVect[NUM_VERTS]for Local it:=0 To NUM_VERTS-1Local angle:cpFloatangle = -2.0*Pi*it/(1.0*NUM_VERTS)verts[it] = cpv(30*Cos(angle), 30*Sin(angle))Nextmoment= cpMomentForPoly(mass, NUM_VERTS, Varptr verts[0], cpvzero, 0.0)polyBody = space.AddBody(cpBodyNew(mass,moment))polyBody.Position=cpv(0.0, -190.0)polyShape=space.AddShape(cpPolyShapeNew(polyBody, NUM_VERTS, Varptr verts[0], cpTransformIdentity, 0.0))' this was working with the unmodified chipmunk importpolyShape.Friction=0.03The full file is attached to a previous post.
November 7, 2016 at 2:40 am #4840the polyshape funcs definitions in shape.monkey2 still had cpBody Ptr as argument so I replaced them with cpBody.
Thanks, will fix (along with others…).
The other problem is actually ‘our’ fault! The ‘mass’ var is of type int, so when you assign 0.3 to it you’re really assigning 0, which chipmunk doesn’t like. It’d be nice to trap the error somehow too…
With that fixed it runs fine – it’s actually really fascinating watching even simple physics happening!
-
AuthorPosts
You must be logged in to reply to this topic.