// Methods internal Enumerator(Transform outer) { this.outer = outer; }
public override void Start() { this.Configuration.BackgroundColour = Rgba32.LightSlateGrey; CommonDemoResources.Create (Platform, Engine); returnScene = this; // create a sprite var billboard = new BillboardPrimitive(this.Platform.Graphics); billboardGo = this.SceneGraph.CreateSceneObject("billboard"); var mr = billboardGo.AddTrait<MeshRendererTrait>(); mr.Mesh = billboard.Mesh; mr.Material = new Material("Default", CommonDemoResources.UnlitShader); mr.Material.SetColour("MaterialColour", RandomGenerator.Default.GetRandomColour()); target = billboardGo.Transform; markerGo = this.SceneGraph.CreateSceneObject ("marker"); markerGo.Transform.LocalScale = new Vector3 (0.05f, 0.05f, 0.05f); var markerMR = markerGo.AddTrait<MeshRendererTrait> (); markerMR.Mesh = new CubePrimitive(this.Platform.Graphics).Mesh; markerMR.Material = new Material("Default", CommonDemoResources.UnlitShader); markerMR.Material.SetColour("MaterialColour", Rgba32.Red); cam = this.CameraManager.GetRenderPassCamera ("Default"); this.SceneGraph.DestroySceneObject(this.CameraManager.GetRenderPassCamera ("Debug")); this.SceneGraph.DestroySceneObject(this.CameraManager.GetRenderPassCamera ("Gui")); this.RuntimeConfiguration.SetRenderPassCameraTo ("Debug", cam); cam.Transform.Position = new Vector3(2, 1, 5); cam.RemoveTrait<OrbitAroundSubjectTrait> (); las = cam.GetTrait<LookAtSubjectTrait> (); las.Subject = billboardGo.Transform; this.Engine.InputEventSystem.Tap += this.OnTap; }
public void Translate(Single x, Single y, Single z, Transform relativeTo) { this.Translate (new Vector3 (x, y, z), relativeTo); }
public void Translate(Vector3 translation, Transform relativeTo) { Vector3 pointInWorld = relativeTo.TransformPoint (translation); Vector3 worldTrans = pointInWorld - relativeTo.Position; this.Position += worldTrans; }
public void LookAt(Transform target, Vector3 worldUp) { LookAt (target.Position, worldUp); }
//Rotates the transform so the forward vector points at /target/'s current position. // // Then it rotates the transform to point its up direction vector in the direction // hinted at by the worldUp vector. If you leave out the worldUp parameter, the // function will use the world y axis. worldUp is only a hint vector. The up // vector of the rotation will only match the worldUp vector if the forward // direction is perpendicular to worldUp public void LookAt(Transform target) { LookAt (target, Vector3.Up); }
// Returns a Booleanean value that indicates whether the transform // is a child of a given transform. true if this transform is a child, // deep child (child of a child...) or identical to this transform, otherwise false. public Boolean IsChildOf(Transform parent) { Transform temp = this; while (temp != null) { if (temp == parent) return true; temp = temp.Parent; } return false; }