WEB开发网
开发学院图形图像Flash Simulating a hook with Box2D 阅读

Simulating a hook with Box2D

 2009-10-18 00:00:00 来源:WEB开发网   
核心提示: Let’s see what I changed from the original scriptFirst, I changed GetBodyAtMouse function – lines 104-126 – so it only returns sta

Let’s see what I changed from the original script

First, I changed GetBodyAtMouse function – lines 104-126 – so it only returns static objects at line 116.

Then, I modified createMouse function – lines 90-97 – in order to create a joint between the center of the ball and the mouse position in the selected static object, and obviously the destroyMouse one to remove the joint when I release the mouse.

There isn’t much more to see that you can’t see in the posts I mentioned before.

Here it is the result:

Click on a static object (green) to create a joint on the fly

No need to include the source code, just replace the script at Box2D joints: Distance Joint with this one.

上一页  1 2 

Tags:Simulating hook with

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接