Rendering joints with Box2D
2009-10-18 00:00:00 来源:WEB开发网核心提示: The key is in the loop at lines 134-137 and its GetJointList() function that gets the world joint list. With the returned joint, using GetNext() I g
The key is in the loop at lines 134-137 and its GetJointList() function that gets the world joint list. With the returned joint, using GetNext() I get the next joint in the world list. A NULL joint indicates the end of the list.
Then, GetAnchor1 and GetAnchor2 return me the anchor point of both bodies linked by the joint in world coordinates.
And that’s it… that easy…
Click on a static object (green) to create a joint on the fly and have it rendered
No need to include the source code, just replace the script at Box2D joints: Distance Joint with this one.
更多精彩
赞助商链接