Inheritance: GameObject
コード例 #1
0
ファイル: PhysicsManager.cs プロジェクト: secred/Tachycardia
        public void addRope(Barrel[] body, Elevator[] connector, Vector3 vec1, Vector3 vec2, int v/*, Character c*/)
        {
            m_Joints.Add("j" + m_Joints.Count, new MogreNewt.BasicJoints.BallAndSocket(Core.Singleton.NewtonWorld, body[v - 1].m_Body, null, body[v - 1].m_Node.Position += new Vector3(0, 1f, 0)));

            for (int i = 0; i < v - 1; i++)
            {

                m_Joints.Add("j" + m_Joints.Count, new MogreNewt.BasicJoints.BallAndSocket(Core.Singleton.NewtonWorld, body[i + 1].m_Body, body[i].m_Body, body[i].m_Node.Position));
            }

            //m_Joints.Add("j" + m_Joints.Count, new MogreNewt.BasicJoints.BallAndSocket(Core.Singleton.NewtonWorld, c.m_Node.,body[v - 1].m_Body , ));
        }
コード例 #2
0
ファイル: Core.cs プロジェクト: secred/Tachycardia
        public void CreateElevator()
        {
            m_Log.LogMessage("Creating elevator...");

            Vector3 vec1 = new Vector3(4f, 1f, 0f);
            Vector3 vec2 = new Vector3(266f, 0f, -7f);

            Mogre.Vector3 wek = new Vector3(vec2.x - vec1.x, vec2.y - vec1.y, vec2.z - vec1.z);

            int dlugoscMostu = 22;
            Barrel[] m_Barrel = new Barrel[dlugoscMostu];
            for (int i = dlugoscMostu - 1; i >= 0; i--)
            {
                m_Barrel[i] = new Barrel("Barrel.mesh", vec1 + new Vector3(98, -25 + i * 0.2f, 68), 15);
                m_ObjectManager.Add("b" + i, m_Barrel[i]);//101 -19 66
            }

            int dlugoscMostu2 = 20;
            Barrel[] m_Barrel2 = new Barrel[dlugoscMostu2];
            for (int i = dlugoscMostu2 - 1; i >= 0; i--)
            {
                m_Barrel2[i] = new Barrel("Barrel.mesh", 5, vec1 + new Vector3(109, -27 + i * 0.5f, 18 + i * 2));
                m_ObjectManager.Add("bb" + i, m_Barrel2[i]);
            }

            Elevator winda = new Elevator("winda2.mesh", 300, new Vector3(143f, -23f, -4f), true);
            m_ObjectManager.Add("winda2", winda);

            m_PhysicsManager.addElevator(winda);
            winda.m_Body.IsGravityEnabled = false;
            winda.m_Body.ForceCallback += winda.CallBack;

            Elevator[] m_Connector = new Elevator[dlugoscMostu * 4];

            m_PhysicsManager.addRope(m_Barrel, m_Connector, vec1, vec2, dlugoscMostu);
            m_Log.LogMessage("bridge created.");
        }