Modify the scale of something in an XR Socket Interactor

I’m making a backpack like the walking dead s&s has. I’m trying to get the objects you put in the backpack to scale down to fit within the slots, but I can’t modify the scale and it gets overwritten by something every time.

    void OnEnterSocket(SelectEnterEventArgs args)
    {
        MeshFilter mesh = args.interactableObject.transform.GetComponent<MeshFilter>();

        Bounds bounds = mesh.mesh.bounds;
        float radius = col.radius*Mathf.Max(transform.lossyScale.x,transform.lossyScale.y,transform.lossyScale.z);

        float scale = radius / bounds.max.magnitude;
        Vector3 scaled = new Vector3(scale, scale, scale);

        Debug.Log(scale); // works
        args.interactorObject.transform.localScale = scaled;
    }

Anyone know how to change the scale of something when it is in the socket interactor? I know I could separate the mesh of the object and scale it down, but I’d prefer to not have to do that for every item in my game.

XRI should support this out of the box. On your XRSocketInteractor component, what do you have Socket Scale Mode set to?

Thank you! Wish I knew about that sooner

1 Like