Example #1
0
        void SaveBodies()
        {
            LSBody[] allBodies = GameObject.FindObjectsOfType <LSBody> ();
            FastList <EnvironmentBodyInfo> bodiesBuffer = new FastList <EnvironmentBodyInfo>();

            foreach (LSBody body in allBodies)
            {
                if (IsAgent(body))
                {
                    continue;
                }
                EnvironmentBodyInfo bodyInfo = new EnvironmentBodyInfo(
                    body,
                    new Vector2dHeight(body.transform.position),
                    new Vector2d(Mathf.Sin(body.transform.rotation.x), Mathf.Cos(body.transform.rotation.y))
                    );
                bodiesBuffer.Add(bodyInfo);
            }

            _environmentBodies = bodiesBuffer.ToArray();
        }
Example #2
0
        void SaveBodies()
        {
            UnityLSBody[] allBodies = GameObject.FindObjectsOfType <UnityLSBody>();
            FastList <EnvironmentBodyInfo> bodiesBuffer = new FastList <EnvironmentBodyInfo>();

            foreach (UnityLSBody body in allBodies)
            {
                if (IsAgent(body))
                {
                    continue;
                }
                Vector3d            pos      = new Vector3d(body.transform.position);
                Vector2d            rot      = Vector2d.CreateRotation(body.transform.eulerAngles.y * Mathf.Deg2Rad);
                EnvironmentBodyInfo bodyInfo = new EnvironmentBodyInfo(
                    body,
                    pos,
                    rot
                    );
                bodiesBuffer.Add(bodyInfo);
            }

            _environmentBodies = bodiesBuffer.ToArray();
        }