How to reset model scale on exit of VR?

In VR I can use both pointers to scale the model, when I exit VR the model’s scale is what I changed it to in VR, I tried resetting the world scale of the model I added but it isn’t that, does the VR mode scale the scene or another child/parent in VR when scaling?

Original Post on Discord

by user 103054507105067008

Hello there – we have an experimental AI bot :robot: that might be able to help you with your question. Would you like to try this out?

You scale the model using the Duplicatable component?
How do you reset the worldscale?

Easiest would be:
theObjectToReset.worldScale = theOldWorldScale

worldScale is availabe for all Object3D types (if ts complains just cast it to GameObject or IGameObject). Just remember that you have to set the whole scale object (same as in Unity when you change a transform property for example)

I’m a bit rusty on the scene setup for VR so I need to look at which component applies scaling to the model in VR to see what scale is being tweaked, I already tried resetting the world scale of the model itself to the original

by user 103054507105067008

You can just do something like this in a component:

<component code here>

onEnterXR() { this.startScale = this.gameObject.worldScale; } 

onLeaveXR() { this.gameObject.worldScale = this.startScale; } 

Got it, I needed to clone the original start scale not copy it and set the transform.scale of the object and not the transform.worldScale which is what I was trying to set

by user 103054507105067008

ah yes cloning it would be recommended here

gameObject.worldScale and transform.worldScale are identical. Transform is just a getter and returns the gameObject