コード例 #1
0
        public void moveOrientedY(float movement)
        {
            float z = FastMath.Cos(this.Rotation.Y) * movement;
            float x = FastMath.Sin(this.Rotation.Y) * movement;

            this.move(x, 0, z);
        }
コード例 #2
0
        /// <summary>
        /// Construye el mesh del Elipsoid
        /// </summary>
        private void updateValues()
        {
            if (vertices == null)
            {
                int verticesCount = (ELIPSOID_MESH_RESOLUTION * 2 + 2) * 3;
                this.vertices = new CustomVertex.PositionColored[verticesCount];
            }

            int index = 0;

            float step = FastMath.TWO_PI / (float)ELIPSOID_MESH_RESOLUTION;

            // Plano XY
            for (float a = 0f; a <= FastMath.TWO_PI; a += step)
            {
                vertices[index++] = new CustomVertex.PositionColored(new Vector3(FastMath.Cos(a) * radius.X, FastMath.Sin(a) * radius.Y, 0f) + center, renderColor);
                vertices[index++] = new CustomVertex.PositionColored(new Vector3(FastMath.Cos(a + step) * radius.X, FastMath.Sin(a + step) * radius.Y, 0f) + center, renderColor);
            }

            // Plano XZ
            for (float a = 0f; a <= FastMath.TWO_PI; a += step)
            {
                vertices[index++] = new CustomVertex.PositionColored(new Vector3(FastMath.Cos(a) * radius.X, 0f, FastMath.Sin(a) * radius.Z) + center, renderColor);
                vertices[index++] = new CustomVertex.PositionColored(new Vector3(FastMath.Cos(a + step) * radius.X, 0f, FastMath.Sin(a + step) * radius.Z) + center, renderColor);
            }

            // Plano YZ
            for (float a = 0f; a <= FastMath.TWO_PI; a += step)
            {
                vertices[index++] = new CustomVertex.PositionColored(new Vector3(0f, FastMath.Cos(a) * radius.Y, FastMath.Sin(a) * radius.Z) + center, renderColor);
                vertices[index++] = new CustomVertex.PositionColored(new Vector3(0f, FastMath.Cos(a + step) * radius.Y, FastMath.Sin(a + step) * radius.Z) + center, renderColor);
            }
        }