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

LUA bindings break when addPhysicsChild() called with ENTITY_MESH #50

Closed
mcclure opened this issue Nov 24, 2011 · 1 comment
Closed

Comments

@mcclure
Copy link
Contributor

mcclure commented Nov 24, 2011

Context: As described in issue #49, I had trouble creating a ScreenMesh. I tried to work around the problem with initializing ScreenMesh by creating (with a C++ polycode program) a mesh file for a totally empty mesh; then I tried loading that and operating on it. This part worked, but...

screen = PhysicsScreen(10, 60) screen:setGravity( Vector2( 0,0 ) ) polygon = Polygon() for i=0,2 do local theta = i/3 * 2 * math.pi polygon:addVertex(math.sin(theta),math.cos(theta),0) end shape = ScreenMesh("blankmesh.dat") shape:getMesh():addPolygon(polygon) shape:setColor(0.0,0.0,0.0,1.0) shape:setPosition(640/2, 400) screen:addPhysicsChild(shape, ENTITY_MESH, false)

So look, I load the blank mesh, then add (what I hope to be) one triangle to it.

When I run this I get:

11/18/11 11:37:36 PM [0x0-0x2b2cb2a].PolycodePlayer[26794] Opened entrypoint file...Tried to make a mesh collision object from a non-mesh

When I look in PolyPhysicsScreenEntity.cpp I find this outcome is possible only if dynamic_cast<ScreenMesh*>(entity) fails (where entity comes from the first argument to addPhysicsChild()). This looks like a LUA problem; I am passing in what should definitely be a ScreenMesh, but C++ is not recognizing it as such.

Ivan says "sounds like a pointer casting issue with the bindings".

Note, this was with a PolycodePlayer I built myself, as described in issue #48. I doubt this could be the problem though.

@ivansafrin
Copy link
Owner

This should work with the new bindings.

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

2 participants