Here are the steps to create a perpendicular plane to the current camera:
- Step 1: Create the plane
- Step 2: Slightly move the plane in front of the camera
- Step 3: Apply a -PI/2 rotation on the created plane on the X axis
- Step 4: Set the plane rotation value on the Y axis to the current camera rotation value on the Y axis
- Step 5: Set the plane rotation value on the X axis to the current camera rotation value on the X axis
- Step 6: If needed, indicate that the created plane is dynamic
- Step 7: Scale the plane on the 3 axis according to the scene
Here's the code:
C#
// Step 1
NovaObject newObject = null;
newObject = myNovaScene.CreateObject(name);
newObject.CreateAsPlane(10f, 10f, 1);
// Step 2
newObject.GlobalPosition = currentCamera.GlobalPosition + new Vector3(0, 0, 1);
// Step 3
newObject.LocalMatrix = Matrix.RotationX(-(float)(Math.PI / 2.0f));
// Step 4
newObject.Rotation.Y = currentCamera.Rotation.Y;
// Step 5
newObject.Rotation.X = currentCamera.Rotation.X;
// Step 6
newObject.IsDynamic = true;
// Step 7
newObject.Scaling.X = 0.5f;
newObject.Scaling.Y = 0.5f;
newObject.Scaling.Z = 0.5f;