Example #1
0
        private void RecordingButton(PressedActionArgs args)
        {
            Rigidbody rig = Owner.GetComponent <Rigidbody>();

            if (!hologramRecording && !hologramPlaying && (rig == null || rig.IsGrounded || !rig.GravityEnabled))
            {
                GameObject hologramRecording = new GameObject("HologramRecorder", Owner.LocalPosition,
                                                              Owner.LocalQuaternionRotation, Owner.LocalScale, Owner.Scene, Owner.Parent);
                hologramRecording.AddComponent(new HologramRecorder(5.0f, 100, StopRecording));
                hologramRecording.AddComponent(new Rigidbody(Owner.GetComponent <Rigidbody>()));
                Collider holCol = hologramRecording.AddNewComponent <Collider>();
                Bounding_Volumes.BoundingBox bound = (Owner.GetComponent <Collider>().bound as Bounding_Volumes.BoundingBox);
                holCol.bound = new Bounding_Volumes.BoundingBox(holCol, bound.Center, new Vector3(bound.HalfLength, bound.HalfHeight, bound.HalfWidth));
                MeshInstance mesh = Owner.GetComponent <MeshInstance>();
                if (mesh != null)
                {
                    hologramRecording.AddComponent(new MeshInstance(mesh));
                }
                if (PlayerMesh != null)
                {
                    Owner.AddComponent(PlayerMesh);
                    AnimationController contr = Owner.AddNewComponent <AnimationController>();
                    contr.BindAnimation("idle", isCrouching ? 7 : 6, true);
                    contr.PlayAnimation("idle");
                }
                Stay(null);
                if (getWeapon() != null)
                {
                    getWeapon().Owner.IsVisible = false;
                }
                player         = Owner;
                playerRotation = Owner.LocalQuaternionRotation;
                Vector3 rotation = Owner.LocalEulerRotation;
                Owner.RemoveComponent(this);
                hologramRecording.AddComponent(this);
                Owner.Scene.Camera.Parent = hologramRecording;
                rotation.Y = 0; rotation.Z = 0;
                player.LocalEulerRotation = rotation;
                this.hologramRecording    = true;
            }
        }
Example #2
0
 public MeshInstance(MeshInstance other) : this(other.model.Model)
 {
 }