This repository was archived by the owner on Jul 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -367,6 +367,7 @@ BrowserWorld::State::UpdateControllers(bool& aRelayoutWidgets) {
367367 vrb::Matrix localRotation = vrb::Matrix::Rotation (hitNormal);
368368 vrb::Matrix reorient = device->GetReorientTransform ();
369369 controller.pointer ->SetTransform (reorient.AfineInverse ().PostMultiply (translation).PostMultiply (localRotation));
370+ controller.pointer ->SetScale (hitPoint, device->GetHeadTransform ());
370371 }
371372 }
372373
Original file line number Diff line number Diff line change @@ -153,9 +153,11 @@ Pointer::SetVisible(bool aVisible) {
153153void
154154Pointer::SetTransform (const vrb::Matrix& aTransform) {
155155 m.transform ->SetTransform (aTransform);
156- vrb::Vector point;
157- point = aTransform.MultiplyPosition (point);
158- const float scale = fabsf (point.z ());
156+ }
157+
158+ void
159+ Pointer::SetScale (const vrb::Vector& aHitPoint, const vrb::Matrix& aHeadTransform) {
160+ const float scale = (aHitPoint - aHeadTransform.MultiplyPosition (vrb::Vector (0 .0f , 0 .0f , 0 .0f ))).Magnitude ();
159161 m.pointerScale ->SetTransform (vrb::Matrix::Identity ().ScaleInPlace (vrb::Vector (scale, scale, scale)));
160162}
161163
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ class Pointer {
2727 bool IsLoaded () const ;
2828 void SetVisible (bool aVisible);
2929 void SetTransform (const vrb::Matrix& aTransform);
30+ void SetScale (const vrb::Vector& aHitPoint, const vrb::Matrix& aHeadTransform);
3031 void SetPointerColor (const vrb::Color& aColor);
3132 void SetHitWidget (const WidgetPtr& aWidget);
3233
You can’t perform that action at this time.
0 commit comments