• R/O
  • SSH
  • HTTPS

nlgp1: Commit


Commit MetaInfo

Revision828 (tree)
Zeit2011-03-01 16:16:25
Autormassa_senohito

Log Message

Programで八角形をテストしました

Ändern Zusammenfassung

Diff

--- trunk/Nlgp1/Nlgp1.Box2DX.Test/Program.cs (revision 827)
+++ trunk/Nlgp1/Nlgp1.Box2DX.Test/Program.cs (revision 828)
@@ -49,16 +49,28 @@
4949 //接触判定する・しないを決められるフラグです、2進法で表しますが、気にしないでください
5050 f.CategoryBits = 1;
5151 f.GroupIndex = 1; f.MaskBits = 1;
52+
5253 DynamicRigid d2 = new DynamicRigid(new Vec2(50, 60), 0 * pi / 180, lineardamping, angularDamping);
53- d2.SetAsBox(16, 32, new Polygondef2(fric2, rest2, dens2, new myUserData("player", 1, f, 2, d2)), false);
54+ //d2.SetAsBox(16, 32, new Polygondef2(fric2, rest2, dens2, new myUserData("player", 1, f, 2, d2)), false);
55+ //d2.SetAsCircle(new CircleDef2(new Vec2(), 16, 0, 0, 1, new myUserData("player", 1, f, 2, d2)), false);
56+ Polygondef2 d2p = new Polygondef2(0, 0, 1, new myUserData("player", 1, f, 2, d2));
57+ //d2p.SetAsBox(12, 12);
58+ d2.UserData = d2p.User;
5459
55- //以下の4行は飛び出ている方のBoxの定義です、コメントアウトするとなくなります
56- /*
57- Polygondef2 d2p = new Polygondef2(friction, restitution, density, new myUserData("d2p", 3, f, 2));
58- d2p.SetAsBox(24, 12, new Vec2(-20, 1), 0);
59- d2p.Fil();
60+ d2p.VertexCount = 8;
61+ d2p.Vertices = new Vec2[]{
62+ new Vec2(-5f,-15f),
63+ new Vec2(5f,-15f),
64+ new Vec2(15f,-5f),
65+ new Vec2(15f,5f),
66+ new Vec2(5f,15f),
67+ new Vec2(-5f,15f),
68+ new Vec2(-15f,5f),
69+ new Vec2(-15f,-5f)
70+ };
71+
6072 d2.Addtolist(d2p);
61- */
73+
6274 d2.NoRotate = true;
6375 d2.MakeBody(world);
6476
@@ -73,6 +85,9 @@
7385
7486 DynamicRigid sail = new DynamicRigid(new Vec2(250, 120), 0, 0, 0);
7587 sail.SetAsBox(250, 25, new Polygondef2(1, 0, 1, new myUserData("sail", 0, f, 2, sail)), false);
88+ Polygondef2 tokki = new Polygondef2(0, 0, 1, new myUserData());
89+ tokki.SetAsBox(18, .1f, new Vec2(0, -25), 0);
90+ sail.Addtolist(tokki);
7691 sail.MakeBody(world);
7792 //Joints joints = new Joints(d1.SelfBody, d2.SelfBody);
7893 //world.CreateJoint(joints.MakeDistanceJoint());
@@ -86,7 +101,7 @@
86101 #endregion
87102 if (DX.CheckHitKey(DX.KEY_INPUT.A)) deltatime = 1 / 120f;
88103 DX.ClearDrawScreen();
89- d2.ApplyForce(new Vec2(10 * d2.Mass, 2 * d2.Mass));
104+ d2.ApplyForce(new Vec2(10 * d2.Mass, 6 * d2.Mass));
90105 sail.ApplyImpulse(new Vec2(900, 0));
91106
92107 DX.DrawString(2, 27, d2.SelfBody.GetPosition().X.ToString() + ", " + d2.SelfBody.GetPosition().Y.ToString(), new DX.COLOR_U8(0xffffff));
Show on old repository browser