Scaling 3D Model on the Meta Quest 3

Godot Version

4.3 on MacOS

Question

Hi everyone,

my name is Kay and I am new to Godot. Started with it yesterday :slight_smile: . My goal is to build an app for my Meta Quest 3 which allows me to scale and rotate a 3D model with the controllers.

I did already some testing and used therefore the samples which are provided in the openxr vendors plugin and the openxr tools. Except for the direct link connection to my Meta Quest, everything works. I have to export the apps and copy it manually to the Meta Quest. I guess it is a MacOS thing, with windows it works.

I checked youtube for hours and watched many tutorials. But I did not find a tutorial which shows how to scale a model directly. I assume that this is not 100% XR related because the scaling should work independently from XR. I don’t want to ask for a step by step tutorial. What I am searching for is a hint what documentation I should read to get this working. Grabbing and moving the object already worked, but for the scaling I don’t know where to start.

Any Link or Hint is really appreciated. Thanks.

Kay

Hey Kay,

Godot not being able to deploy directly to the Quest means that it can’t locate, or is not allowed to run, ADB. So make sure that is either in your path or set correctly in the editor settings.

The scaling/rotating question is a little harder to answer. In principle its not hard but it has a number of moving parts.

If you have grabbing working, and especially if you have detected two hands holding your object.

Scaling becomes something you drive by the distance between the two hands. So you calculate the distance at the time both hands grab the object (so start_distance = ($left_hand.global_position - $right_hand.global_position).lenght()).
Then every frame you calculate the distance again (so new_distance = ($left_hand.global_position - $right_hand.global_position).lenght()) and then set the scale of your object:

var scale = new_distance / start_distance
held_object.scale = Vector3(scale, scale, scale)

If the object was already scaled before you picked it up, you should just record that as a start_scale = held_object.scale and change the code to held_object.scale = start_scale * Vector3(scale, scale, scale)

Excuse any typos.

Hi and thanks for your answer.

I will follow your suggestions and let you know how it went :slight_smile: There is a lot to learn for me, but I am happy to do it.

BR
Kay

1 Like