| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
10年前发布

HTML5 JavaScript 2D 物理引擎:Matter.js

Matter.js是一款采用JavaScript编写的2D刚体物理引擎。

var Bodies = Matter.Bodies;  var Engine = Matter.Engine;  var engine = Engine.create(container, options);  var World = Matter.World;    World.addBody(engine.world, Bodies.rectangle(300, 180, 700, 20, { isStatic: true, angle: Math.PI * 0.06 }));  World.addBody(enigne.world, Bodies.rectangle(300, 70, 40, 40, { friction: 0.001 }));

特性:

  • Physical properties (mass, area, density etc.)
  • Rigid bodies of any convex polygon
  • Stable stacking and resting
  • Restitution (elastic and inelastic collisions)
  • Conservation of momentum
  • Friction and resistance
  • Constraints
  • Gravity
  • Composite bodies
  • Sleeping and static bodies
  • Original JavaScript physics implementation (not a port)
  • HTML5 canvas renderer
  • Mobile-compatible (touch, scaleable)
  • Cross-browser (chrome, firefox, IE8+)
  • World state serialisation (requires resurrect.js)
  • Built in GUI for testing (requires dat.gui.js)
  • Time scaling (slow-mo, speed-up)
  • Broad-phase, mid-phase and narrow-phase collisions


项目主页:http://www.open-open.com/lib/view/home/1393999878115

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1393999878115.html
Matter.js 游戏开发