Stylus linked to mouse scripts

Hello, I have an existing project I’m trying to convert to a zspace project.

There are several scripts tied to the mouse that I would like the stylus to adopt such as highlighting objects and triggering animations.

Is there a simple way to adapt the stylus script to register click events? I just don’t want to have to start from scratch. Thanks!

Hi Haas3d,

Are you using Unity3D or a different engine? If you’re using anything other than Unity3D, then you will be largely on your own. The best I could do is advise you on best-practices when it comes to implementing the stylus within legacy interaction systems.

We can probably assist with alternative engines, but you will have to pose your question in such a way that acknowledges our lack of context given that we probably know little to nothing about your engine’s input event system.

If you aren’t using Unity3D, but have a working familiarity with it, then I would recommend studying how that is implemented for inspiration within your own engine.

If you are using Unity3D and our zCore version 6.x.x, then you have access to a pre-made solution. ZInputModule and ZGraphicRaycaster are specially designed to extend Unity’s built-in event system. These enable our ZStylus and ZMouse objects to act as first-class citizens in Unity’s UI and 3d collider event system.

ZInputModule and ZGraphicRaycaster simply need to be present in the scene to negotiate events, so you will want to refer to the documentation and samples for how/where to set them up within your scene.
https://developer.zspace.com/docs/unity3d-zcore-6-guide?scrollTo=zgraphicraycaster

Here’s a section of our documentation explaining that we have extended Unity’s IPointerHandler events. This is our preferred way of handling event driven input device behavior.
https://developer.zspace.com/docs/unity3d-zcore-6-guide?scrollTo=ipointerhandlers

Be sure to check out the included sample script Draggable.cs. This is a good boilerplate 3d interaction script that showcases how zCore extends Unity’s interaction even system.

Be sure to read up on the documentation and explore the pre-supplied samples that come with zCore. If you still have questions, please feel free to follow up!

Alex S.