コード例 #1
0
 public SphereMover(LookAtSurfaceCamera camera, SphereSurface surface, float zoomSpeed, float rotateSpeed)
 {
     this.camera = camera;
     this.surface = surface;
     this.zoomSpeed = zoomSpeed;
     this.rotateSpeed = rotateSpeed;
 }
コード例 #2
0
ファイル: PlaneMover.cs プロジェクト: wlindley/CameraControls
 public PlaneMover(LookAtSurfaceCamera camera, PlaneSurface surface, float zoomSpeed, float panSpeed)
 {
     this.camera = camera;
     this.surface = surface;
     this.zoomSpeed = zoomSpeed;
     this.panSpeed = panSpeed;
 }
コード例 #3
0
 internal override LookAtSurfaceCamera GetCamera()
 {
     if (null == cam)
     {
         cam = new LookAtSurfaceCamera(transform, surface.GetSurface());
         cam.InitializeCamera();
     }
     return cam;
 }
コード例 #4
0
        public void SetUp()
        {
            surfaceOrigin = Vector3.zero;
            surfaceNormal = Vector3.up;
            surfaceUp = Vector3.forward;
            surface = new PlaneSurface(surfaceOrigin, surfaceNormal, surfaceUp);

            var cameraGO = new GameObject();
            transform = cameraGO.transform;
            camera = new LookAtSurfaceCamera(transform, surface);
        }
コード例 #5
0
        public void ClampCameraToBounds(LookAtSurfaceCamera camera)
        {
            var maxY = boundsCenter.y + (boundsSize.y * .5f);
            var minY = boundsCenter.y - (boundsSize.y * .5f);
            var distanceToTarget = camera.GetDistanceToTarget();
            if (distanceToTarget >= maxY)
                camera.SetDistanceToTarget(maxY);
            else if (distanceToTarget <= minY)
                camera.SetDistanceToTarget(minY);

            var minX = boundsCenter.x - (boundsSize.x * .5f);
            var lookTarget = camera.GetLookTarget();
            var delta = lookTarget - boundsCenter;
            if (lookTarget.x <= minX)
                camera.TranslateLookTargetTo(new Vector3(minX, lookTarget.y, lookTarget.z));
        }
コード例 #6
0
 private void BuildTestObj()
 {
     testObj = new LookAtSurfaceCamera(testTransform, surface);
     testObj.InitializeCamera();
 }
コード例 #7
0
        public void SetUp()
        {
            surfaceOrigin = Vector3.zero;
            surfaceNormal = Vector3.up;
            surfaceUp = Vector3.forward;
            surface = new PlaneSurface(surfaceOrigin, surfaceNormal, surfaceUp);

            var cameraGO = new GameObject();
            transform = cameraGO.transform;
            camera = new LookAtSurfaceCamera(transform, surface);

            boundsCenter = new Vector3(10f, 5f, 10f);
            boundsSize = new Vector3(5f, 5f, 5f);
            testObj = new AABoxCameraBounds(surface, boundsCenter, boundsSize);
        }
コード例 #8
0
        public void SetUp()
        {
            surfaceOrigin = Vector3.zero;
            surfaceNormal = Vector3.up;
            surfaceUp = Vector3.forward;
            surface = new PlaneSurface(surfaceOrigin, surfaceNormal, surfaceUp);

            initialCameraDistance = 100f;
            initialLookTarget = Vector3.zero;
            timeDelta = .25f;
            camera = Substitute.For<LookAtSurfaceCamera>();
            camera.GetDistanceToTarget().Returns(initialCameraDistance);
            camera.GetLookTarget().Returns(initialLookTarget);

            zoomSpeed = 5f;
            panSpeed = 10f;
            testObj = new PlaneMover(camera, surface, zoomSpeed, panSpeed);
        }
コード例 #9
0
        public void SetUp()
        {
            surfaceOrigin = Vector3.zero;
            surfaceUp = Vector3.up;
            surfaceRadius = 10f;
            surface = new SphereSurface(surfaceOrigin, surfaceRadius, surfaceUp);

            initialCameraDistance = 100f;
            timeDelta = .25f;

            var go = new GameObject();
            transform = go.transform;
            camera = new LookAtSurfaceCamera(transform, surface);
            camera.InitializeCamera();
            camera.SetDistanceToTarget(initialCameraDistance);

            zoomSpeed = 10f;
            rotateSpeed = Mathf.PI;
            testObj = new SphereMover(camera, surface, zoomSpeed, rotateSpeed);
        }