AB4D Forum

Full Version: Facing and rotating Plane towards camera
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!

I did some search trough the forum and found tips but those did not quite fit into my problem.

I like to know the way to face PlaneVisual3D inside Viewport3D towards camera. I have put text on the planes material so it would be neat that text is readibile while camera moves around 3D object. I have been using TargetPositionCamera.

Cheers!
You can synchronize the direction of PlaneVisual3D and Camera with updating the Normal and HeightDirection properties on PlaneVisual3D on each Camera's change.

First you need to subscribe to CameraChanged event on Ab3d.PowerToys's camera that you are using.

Then in the event handler you first need to get the Viewport3D's Camera - it has the LookDirection. Than you can set he the Normal and HeightDirection:
Code:
planeVisual3D.Normal = new Vector3D(-wpfCamera.LookDirection.X, -wpfCamera.LookDirection.Y, -wpfCamera.LookDirection.Z); // Plane normal is looking in the opposite direction of the camera look direction
planeVisual3D.HeightDirection = wpfCamera.UpDirection;

This should do the trick

(09-07-2015, 01:48 PM)curimus Wrote: [ -> ]Hi!

I did some search trough the forum and found tips but those did not quite fit into my problem.

I like to know the way to face PlaneVisual3D inside Viewport3D towards camera. I have put text on the planes material so it would be neat that text is readibile while camera moves around 3D object. I have been using TargetPositionCamera.

Cheers!
Wow! that did the trick! Never knew that would be so simple! Thanks for your quick reply!

Cheers!

(09-07-2015, 03:25 PM)abenedik Wrote: [ -> ]You can synchronize the direction of PlaneVisual3D and Camera with updating the Normal and HeightDirection properties on PlaneVisual3D on each Camera's change.

First you need to subscribe to CameraChanged event on Ab3d.PowerToys's camera that you are using.

Then in the event handler you first need to get the Viewport3D's Camera - it has the LookDirection. Than you can set he the Normal and HeightDirection:
Code:
planeVisual3D.Normal = new Vector3D(-wpfCamera.LookDirection.X, -wpfCamera.LookDirection.Y, -wpfCamera.LookDirection.Z); // Plane normal is looking in the opposite direction of the camera look direction
planeVisual3D.HeightDirection = wpfCamera.UpDirection;

This should do the trick

(09-07-2015, 01:48 PM)curimus Wrote: [ -> ]Hi!

I did some search trough the forum and found tips but those did not quite fit into my problem.

I like to know the way to face PlaneVisual3D inside Viewport3D towards camera. I have put text on the planes material so it would be neat that text is readibile while camera moves around 3D object. I have been using TargetPositionCamera.

Cheers!