Changing stylus to use mesh instead of line render

Hi i’m trying to use meshes instead of line renders to draw the stylus and its head/tip

however when i move the move the mesh being used to visualize the stylus to the position where the line render would have been it causes a strange effect to happen with the mesh i’m clicking on with the stylus.

what happens is once i click on the object ii wish to rotate and move i cant let go of it with the stylus.

here’s the code i’m using

            Vector3 start = stylusPosition;
            Vector3 end = stylusPosition + (stylusDirection * stylusBeamLength);

            Vector3 scale = new Vector3(stylusBeamWidth, offset.magnitude, stylusBeamWidth);
            Vector3 position = start + (offset / 2.0f);
            beamCylinder.transform.position = position;
            beamCylinder.transform.up = offset;
            beamCylinder.transform.localScale = scale;

its almost as if using a mesh to visualize the stylus is interfering with the stylus ability to garb objects in the scene

can anyone give an example of how you should properly implement a custom stylus.

i like the one used in the zspace experience application and would like to implement something like that.

The mesh you’re using for the stylus might have a collider on it. That would interfere with raycasts.

i thought that to at first but i’m specifically turning off its collider after i instantiate it.

beamCylinder = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
beamCylinder.GetComponent().enabled = false;

i also tried it with a object that had its collider component removed.

I don’t see anything particularly problematic in your snippet. If I’m understanding you right, and the problem you’re having is that grabbed objects aren’t being released when the stylus button is released, I’ll need to see the actual logic gating you have set up to engage and disengage the grab. You might as well share the whole script.

i appreciate the feedback, i ended up just using line renders to avoid the headache.