Scale up and down 3D Model with stylus

Hi Developer Community,

Need one help with adding a feature on stylus button.
I am trying to scale up and down 3D model based on the right click of the stylus.
So far, I am able to scale up and down model through right button press but at the constant rate.

But I would like to do the same with stylus, where user changes the 3D Model scale by moving stylus towards or away from the screen.

Any feedback is appreciated.
I am using zCore 6 & Unity 2019x

Thanks and regards
Gautam

Hi Gautam,

The easiest way would be with the stylus’ TrackerPose property. Measure the TrackerPose’s z axis while moving the stylus through space. stylus.TrackerPose.position.z

Be aware that a TrackerPose is oriented in TrackerSpace which means that the z-axis is parallel with the real-world ground plane. The axis will not be exactly perpendicular to the display unless the display is vertically upright and square with the ground. For the purposes you are interested in however, it shouldn’t matter much.