public PlaneMover(LookAtSurfaceCamera camera, PlaneSurface surface, float zoomSpeed, float panSpeed) { this.camera = camera; this.surface = surface; this.zoomSpeed = zoomSpeed; this.panSpeed = panSpeed; }
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 ClampPointToSurfaceForcesOffsetToOriginAlongNormalWhenPlaneIsTilted( [NUnit.Framework.Random(-10.0, 10.0, 3)] double x, [NUnit.Framework.Random(-10.0, 10.0, 3)] double y, [NUnit.Framework.Values(0.0)] double z) { normal = new Vector3(.3f, .7f, 0f); testObj = new PlaneSurface(origin, normal, up); var pos = new Vector3((float)x, (float)y, (float)z); var delta = pos - origin; var distanceFromSurface = Vector3.Dot(delta, normal.normalized); var pointOnSurface = pos - (distanceFromSurface * normal.normalized); TestUtil.AssertApproximatelyEqual(pointOnSurface, testObj.ClampPointToSurface(pos)); }
public void SetUp() { surfaceOrigin = Vector3.zero; surfaceNormal = Vector3.up; surfaceUp = Vector3.forward; surface = new PlaneSurface(surfaceOrigin, surfaceNormal, surfaceUp); curvePoints = new CurveControlPoint[2]; curvePoints[0] = new CurveControlPoint(1f, 10f); curvePoints[1] = new CurveControlPoint(10f, 90f); curve = new LerpCurve(curvePoints); var testGO = new GameObject(); testTransform = testGO.transform; testObj = new AngledLookAtSurfaceCamera(testTransform, surface, curve); }
public void SetUp() { origin = new Vector3(0, -10, 0); normal = new Vector3(0, 0, 1); up = new Vector3(0, 1, 0); testObj = new PlaneSurface(origin, normal, up); }
public void NormalIsUnitVector() { testObj = new PlaneSurface(origin, normal * 10f, up); TestUtil.AssertApproximatelyEqual(1f, testObj.GetNormalAtPoint(origin).magnitude); }
internal override Surface GetSurface() { if (null == surface) surface = new PlaneSurface(transform.position, transform.up, transform.forward); return surface; }
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); }