![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Box2D
Markooa
这个作者很懒,什么都没留下…
展开
-
Box2D中拖动物体
思路:在鼠标单击事件中判断鼠标是否在物体上单击了,如果是在某一个物体上单击,则得到鼠标单击的物体,并创建一个跟鼠标进行相连的 mouseJoint(b2MouseJoint),mouseJoint中的body1设为没有形状的刚体,即由 world.GetGroundBody()创建,body2设为单击处的物体。再世界更新过程中不断更新mouseJoint的目标为鼠标位置,则看上去物体就被鼠标拖动了转载 2011-02-14 19:34:00 · 1722 阅读 · 1 评论 -
Box2D获取鼠标单击处的物体
思路:从鼠标单击处创建一个很小范围的边界盒,查找是否有刚体与此边界盒相交,如果有相交,则记下此刚体,在此刚体不是休眠状态时,检查鼠标单击点是否在此刚体所包含的区域。具体代码如下: function getBodyAtMouse():b2Body { //根据鼠标单击位置创建向量转载 2011-02-14 18:51:00 · 1244 阅读 · 0 评论 -
DistanceJoint
这篇是紧接Box2DAS3中如何拖动物体的,主要是演示如何应用b2DistanceJoint类,b2DistanceJoint类主要作用是使两个物体保持一定距离而不相互靠近,要创建b2DistanceJoint的实例须先创建b2DistanceJointDef的实例,在b2DistanceJointDef的定义中定义要相连的两个物体,以及两个物体上的两个连接点。 闪吧新社区.V`b9I转载 2011-02-14 20:01:00 · 994 阅读 · 0 评论 -
单一形状的刚体与复合形状的刚体
一.创建单一形状的刚体步骤Cp-t/^y0创建形状定义(b2PolygonDef,b2CircleDef等);创建刚体定义(b2BodyDef);用b2World根据刚体定义创建刚体body,即body = world.CreateBody(b2BodyDef);将形状附加到body,即多边形body.CreateShape(b2PolygonDef)或圆形body.Create转载 2011-02-14 20:26:00 · 1315 阅读 · 0 评论 -
Collision Detection Tutorial
While Box2D handles all the collision detection and resolution of the physics, it would also be useful for us to be able to determine when and what objects collide. So this will be what we will learn转载 2011-02-18 11:02:00 · 1127 阅读 · 0 评论 -
Box2D入门(v2.0)
现在网上关于as3的物理引擎真是不少,比较之后发现,在开源引擎当中Box2D算是比较不错的了,只可惜他的结构比较复杂,而且国内网站关于Box2D方面的教程真是少的可怜。因为我知道这个最早是c++上面的2D引擎,所以我找到了http://www.box2d.org/manual.html网址,经过几天的研究,总算是入门了,下面我会系统的针对官网给出的HelloWorld程序进行讲解,把个人心得分享给转载 2011-01-24 10:48:00 · 676 阅读 · 0 评论 -
b2DebugDraw
b2DebugDraw提供调试功能,由于Box2D中所有对象都是不可见的,要创建可见对象我们得用刚体定义中的userData属性来创建自己的图形,如果不创建自己的图形,则用b2DebugDraw类来实现物体的可见,方便调试。 闪吧新社区7uV`8a?1nC/闪吧新社区&x:^7V0^${i x具体代码:private function showDebug():void{转载 2011-02-14 20:07:00 · 889 阅读 · 0 评论 -
custom textures and Shapes
So in Part 3 of this series we will be moving awayfrom relying on the debug draw and SetAsBox function, and, instead wewill be creating custom shapes and textures by building a truck in ourBox2D world转载 2011-02-15 12:06:00 · 1067 阅读 · 0 评论 -
Collision filtering
We will be specifying filters so we can control which objects collide with which, rather than the default of all objects colliding.In order to do this, we specify which objects can collide when we c转载 2011-02-18 14:07:00 · 999 阅读 · 0 评论 -
Collision strength
Today, we will once again be returning to the topic of collisions to answer a request which was, “how to determine the strength involved in a collision”. By gaining access to this information, we can转载 2011-02-18 15:51:00 · 1129 阅读 · 0 评论 -
随机刚体demo
package{ import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; import Box2D.Common.Math.*; import Box2D.Dynamics.*; import flash.转载 2011-02-14 14:06:00 · 567 阅读 · 0 评论 -
Box2D Tutorials
http://www.box2dflash.org/docs/http://www.kerp.net/box2d/index.php原创 2011-01-18 09:04:00 · 500 阅读 · 0 评论