LoginSignup
0
0

More than 5 years have passed since last update.

p2 物理エンジンではまった

Posted at
const b = new p2.Body({position:[x, y]});
b.addShape(new p2.Box({width: w, height: 1}));

この場合のBodyの衝突範囲は下記になる

{
 left:  x - w / 2,
 top:   y - h / 2,
 right: x + w / 2,
 bottom: y + h / 2
}

下記だと勘違いしていた

{
 left:  x,
 top:   y,
 right: x + w,
 bottom: y + h
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0