public SphereMover(LookAtSurfaceCamera camera, SphereSurface surface, float zoomSpeed, float rotateSpeed) { this.camera = camera; this.surface = surface; this.zoomSpeed = zoomSpeed; this.rotateSpeed = rotateSpeed; }
public PlaneMover(LookAtSurfaceCamera camera, PlaneSurface surface, float zoomSpeed, float panSpeed) { this.camera = camera; this.surface = surface; this.zoomSpeed = zoomSpeed; this.panSpeed = panSpeed; }
internal override LookAtSurfaceCamera GetCamera() { if (null == cam) { cam = new LookAtSurfaceCamera(transform, surface.GetSurface()); cam.InitializeCamera(); } return cam; }
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); }
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)); }
private void BuildTestObj() { testObj = new LookAtSurfaceCamera(testTransform, surface); testObj.InitializeCamera(); }
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); }
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); }
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); }