public Sphere(float Radius, GraphicsDevice graphics, Texture2D tex, Texture2D prograde, Texture2D retrograde, Texture2D maneuverPrograde, Texture2D targetPrograde, Texture2D targetRetrograde) { this.prograde = new Bilboard (prograde, Matrix.CreateScale (1.0f)); this.retrograde = new Bilboard (retrograde, Matrix.CreateScale (1.0f)); this.maneuverPrograde = new Bilboard (maneuverPrograde, Matrix.CreateScale (1.0f)); this.targetPrograde = new Bilboard (targetPrograde, Matrix.CreateScale (1.0f)); this.targetRetrograde = new Bilboard (targetRetrograde, Matrix.CreateScale (1.0f)); texture = tex; radius = Radius; graphicd = graphics; effect = new BasicEffect(graphicd); nvertices = res * res; // 90 vertices in a circle, 90 circles in a sphere nindices = res * res * 6; vbuffer = new VertexBuffer(graphics, typeof(VertexPositionNormalTexture), nvertices, BufferUsage.WriteOnly); ibuffer = new IndexBuffer(graphics, IndexElementSize.SixteenBits, nindices, BufferUsage.WriteOnly); createspherevertices(); createindices(); vbuffer.SetData<VertexPositionNormalTexture>(vertices); ibuffer.SetData<short>(indices); effect.TextureEnabled = true; effect.LightingEnabled = true; rotQuat = Quaternion.Identity; }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody>(); rb.velocity = floatdir; if (bilboard) { Bilboard.Calculate(transform); } }
public void Init(Transform character) { m_CharacterTargetRot = character.localRotation; m_CameraTargetRot = camera.transform.localRotation; Bilboard.SetCamera(camera); }