/// <summary> /// 車の生成 /// </summary> private void CreateCar() { // 車体 _carBody = new ODE.Object.Box( _world, _space, STARTX, STARTY, STARTZ, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 9.0f, WIDTH, LENGTH, HEIGHT ); // URG _urg = new ODE.Object.Box( _world, _space, STARTX, STARTY + LENGTH / 2 - 0.1f, STARTZ + HEIGHT / 2 + 0.05f, 0.0f, 0.0f, 0.0f, 0.0f, STARTX, STARTY + LENGTH / 2 - 0.1f, STARTZ + HEIGHT / 2 + 0.05f, 1.0f, 0.0f, 0.0f, 0.1f, 0.1f, 0.1f, 0.1f ); _urg.CreateJoint(Ode.JointType.Hinge, _carBody); // 後左輪 _wheel[0] = new ODE.Object.Cylinder( _world, _space, STARTX - WIDTH / 2 - THICKNESS_REAR / 2, STARTY - LENGTH / 2, RADIUS_REAR, 0.0f, 1.0f, 0.0f, Ode.PI / 2, STARTX + WIDTH / 2 + THICKNESS_REAR / 2, STARTY - LENGTH / 2, RADIUS_REAR, 1.0f, 0.0f, 0.0f, 0.2f, RADIUS_REAR, THICKNESS_REAR ); // 後右輪 _wheel[1] = new ODE.Object.Cylinder( _world, _space, STARTX + WIDTH / 2 + THICKNESS_REAR / 2, STARTY - LENGTH / 2, RADIUS_REAR, 0.0f, 1.0f, 0.0f, Ode.PI / 2, STARTX - WIDTH / 2 - THICKNESS_REAR / 2, STARTY - LENGTH / 2, RADIUS_REAR, 1.0f, 0.0f, 0.0f, 0.2f, RADIUS_REAR, THICKNESS_REAR ); // 前左輪 _wheel[2] = new ODE.Object.Cylinder( _world, _space, STARTX - WIDTH / 2 - THICKNESS_FRONT / 2, STARTY + LENGTH / 2, RADIUS_FRONT, 0.0f, 1.0f, 0.0f, Ode.PI / 2, STARTX - WIDTH / 2 - THICKNESS_FRONT / 2, STARTY + LENGTH / 2, RADIUS_FRONT, 1.0f, 0.0f, 0.0f, 0.2f, RADIUS_FRONT, THICKNESS_FRONT ); // 全右輪 _wheel[3] = new ODE.Object.Cylinder( _world, _space, STARTX + WIDTH / 2 + THICKNESS_FRONT / 2, STARTY + LENGTH / 2, RADIUS_FRONT, 0.0f, 1.0f, 0.0f, Ode.PI / 2, STARTX + WIDTH / 2 + THICKNESS_FRONT / 2, STARTY + LENGTH / 2, RADIUS_FRONT, 1.0f, 0.0f, 0.0f, 0.2f, RADIUS_FRONT, THICKNESS_FRONT ); _wheel[0].CreateJoint(Ode.JointType.Hinge, _carBody); _wheel[1].CreateJoint(Ode.JointType.Hinge, _carBody); _wheel[2].CreateJoint(Ode.JointType.Hinge, _carBody); _wheel[3].CreateJoint(Ode.JointType.Hinge, _carBody); //// URG //_urg = new ODE.Object.Box( // _world, _space, // 0.0f, LENGTH / 2 - 0.1f, STARTZ + HEIGHT / 2 + 0.05f, // 0.0f, 0.0f, 0.0f, // 0.0f, // 0.0f, LENGTH / 2 - 0.1f, STARTZ + HEIGHT / 2 + 0.05f, // 1.0f, 0.0f, 0.0f, // 0.1f, // 0.1f, 0.1f, 0.1f //); //_urg.CreateJoint(Ode.JointType.Hinge, _carBody); //// 後左輪 //_wheel[0] = new ODE.Object.Cylinder( // _world, _space, // -WIDTH / 2 - THICKNESS_REAR / 2, -LENGTH / 2, RADIUS_REAR, // 0.0f, 1.0f, 0.0f, // Ode.PI / 2, // WIDTH / 2 + THICKNESS_REAR / 2, -LENGTH / 2, RADIUS_REAR, // 1.0f, 0.0f, 0.0f, // 0.2f, // RADIUS_REAR, // THICKNESS_REAR //); //// 後右輪 //_wheel[1] = new ODE.Object.Cylinder( // _world, _space, // WIDTH / 2 + THICKNESS_REAR / 2, -LENGTH / 2, RADIUS_REAR, // 0.0f, 1.0f, 0.0f, // Ode.PI / 2, // -WIDTH / 2 - THICKNESS_REAR / 2, -LENGTH / 2, RADIUS_REAR, // 1.0f, 0.0f, 0.0f, // 0.2f, // RADIUS_REAR, // THICKNESS_REAR //); //// 前左輪 //_wheel[2] = new ODE.Object.Cylinder( // _world, _space, // -WIDTH / 2 - THICKNESS_FRONT / 2, LENGTH / 2, RADIUS_FRONT, // 0.0f, 1.0f, 0.0f, // Ode.PI / 2, // -WIDTH / 2 - THICKNESS_FRONT / 2, LENGTH / 2, RADIUS_FRONT, // 1.0f, 0.0f, 0.0f, // 0.2f, // RADIUS_FRONT, // THICKNESS_FRONT //); //// 全右輪 //_wheel[3] = new ODE.Object.Cylinder( // _world, _space, // WIDTH / 2 + THICKNESS_FRONT / 2, LENGTH / 2, RADIUS_FRONT, // 0.0f, 1.0f, 0.0f, // Ode.PI / 2, // WIDTH / 2 + THICKNESS_FRONT / 2, LENGTH / 2, RADIUS_FRONT, // 1.0f, 0.0f, 0.0f, // 0.2f, // RADIUS_FRONT, // THICKNESS_FRONT //); //_wheel[0].CreateJoint(Ode.JointType.Hinge, _carBody); //_wheel[1].CreateJoint(Ode.JointType.Hinge, _carBody); //_wheel[2].CreateJoint(Ode.JointType.Hinge, _carBody); //_wheel[3].CreateJoint(Ode.JointType.Hinge, _carBody); }
/// <summary> /// 壁の生成 /// </summary> private void CreateWall() { Real HEIGHT = 1.0f; // 壁 _wall[0] = new ODE.Object.Box( _world, _space, -2.0f, 2.0f, HEIGHT/2, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f, 3.0f, 1.0f, HEIGHT ); _wall[1] = new ODE.Object.Box( _world, _space, 1.0f, 8.0f, HEIGHT/2, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f, 1.0f, 2.0f, HEIGHT ); _wall[2] = new ODE.Object.Box( _world, _space, -2.0f, 12.0f, HEIGHT/2, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f, 2.0f, 1.0f, HEIGHT ); _wall[3] = new ODE.Object.Box( _world, _space, 0.0f, 15.0f, HEIGHT/2, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f, 2.0f, 1.0f, HEIGHT ); for (int i = 0; i < 4; i++) { _wall[i].CreateJoint(Ode.JointType.Fixed); } }