- Create your sphere
- Create an hgtransform object
- Make the transform the parent of the sphere graphics object
- Create a transformation matrix using makehgtransform based on your camera data
- Set the transformation matrix as the 'Matrix' property of the hgtransfrom
- Update the figure by calling drawnow
- Repeat steps 6-7 as the camera moves and rotates.
Position of sphere updated based on camera position/pan/rotation
4 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have a gui, where I want to plot a sphere whose position gets updated based on the camera properties.Basically, if the camera rotates, the sphere all rotates, so all movement is mirrored.
I have code which extracts the cam Position, cam Target, cam ViewAngle, camViewVector, cam RightVector and cam UpVector.
Does anyone have an idea on an efficient way this can be done?
Thanks, Rheeda
0 件のコメント
採用された回答
Alain Kuchta
2017 年 3 月 22 日
I understand you would like to transform the position and rotation of a sphere based on data from a camera.
You can use an hgtransform object to apply a transformation to one or many graphics objects in unison. Using an hgtransform in your project could work as follows:
The "Transforming Objects Independently" example from the hgtransform documentation can help you get started. It can be found at the follow link:
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Lighting, Transparency, and Shading についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!