# User-scaling of AR Content

**URL:** <https://forum.needle.tools/t/user-scaling-of-ar-content/296>\
**Category:** 🌵 Needle Engine\
**Tags:** question\
**Created:** [January 29, 2023, 12:00am UTC](https://forum.needle.tools/t/user-scaling-of-ar-content/296 "2023-01-29T00:00:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![discord-import](https://forum.needle.tools/user_avatar/forum.needle.tools/discord-import/32/33_2.png) [@discord-import](https://forum.needle.tools/u/discord-import)\
**Post date:** [January 29, 2023, 12:00am UTC](https://forum.needle.tools/t/user-scaling-of-ar-content/296/1 "2023-01-29T00:00:00Z")

</div>

Hi… could someone point me in the right direction for the best/preferred method of adding a facility for users to resize AR content in their space via pinch and zoom?

Many thanks, in advance, for any advice or links to tutorials (happy to learn 🙂 ).

[Original Post on Discord](https://discord.com/channels/717429793926283276/1068978303765061703)

_by user 908977119781060648_

---

<div class="post-metadata">

**Author:** ![discord-import](https://forum.needle.tools/user_avatar/forum.needle.tools/discord-import/32/33_2.png) [@discord-import](https://forum.needle.tools/u/discord-import)\
**Post date:** [January 30, 2023, 12:00am UTC](https://forum.needle.tools/t/user-scaling-of-ar-content/296/2 "2023-01-30T00:00:00Z")

</div>

No tips from me but I started working on an example for this ages ago but have been too busy to finish it 😦

_by user 103054507105067008_

---

<div class="post-metadata">

**Author:** ![discord-import](https://forum.needle.tools/user_avatar/forum.needle.tools/discord-import/32/33_2.png) [@discord-import](https://forum.needle.tools/u/discord-import)\
**Post date:** [January 30, 2023, 12:00am UTC](https://forum.needle.tools/t/user-scaling-of-ar-content/296/3 "2023-01-30T00:00:00Z")

</div>

Cheers for the reply @ROBYER1… and no worries, I’ll keep hunting around and post up here if I come across a good/workable/robust solution 🙂

_by user 908977119781060648_

---

<div class="post-metadata">

**Author:** ![discord-import](https://forum.needle.tools/user_avatar/forum.needle.tools/discord-import/32/33_2.png) [@discord-import](https://forum.needle.tools/u/discord-import)\
**Post date:** [January 31, 2023, 12:00am UTC](https://forum.needle.tools/t/user-scaling-of-ar-content/296/4 "2023-01-31T00:00:00Z")

</div>

i have worked on something like this recently: ``` if(this.context.input.getTouchesPressedCount() \>= 2){

```
            let newPosition0 = this.context.input.getPointerPosition(0);
            let newPosition1 = this.context.input.getPointerPosition(1);
            let oldPosition0 = this.context.input.getPointerPositionLastFrame(0);
            let oldPosition1 = this.context.input.getPointerPositionLastFrame(1);

            if(oldPosition1 && oldPosition0 && newPosition0 && newPosition1){

                //rotating
                let oldVector = new Vector2;
                let newVector = new Vector2;

                oldVector = oldVector.subVectors(oldPosition0, oldPosition1);
                newVector = newVector.subVectors(newPosition0, newPosition1);

                let oldangle = oldVector.angle();
                let newangle = newVector.angle();
                let angle = oldangle-newangle;
                angle = (angle*180/Math.PI)/(this.slowDownRotation);

                if(angle >= 1 || angle <= -1){
                    angle = 0;
                }else{
                    this.gameObject.rotateY(angle);
                    //console.log("AR rotation change: ("+ angle + ")");
                }
                // scaling
                let oldDistance = oldPosition0.distanceTo(oldPosition1);
                let newDistance = newPosition0?.distanceTo(newPosition1);
                let scaleChange = newDistance/oldDistance;

                if(scaleChange>= 1.1 || scaleChange <= 0.9){//not to much of a change (mainly because sometimes scale 0)
                    scaleChange == 1;
                }else{
                    this.gameObject.scale.multiplyScalar(scaleChange);
                    //console.log("AR scale change: ("+ scaleChange+ ")");
                }
            }
        }

```

```auto

*by user 253912725917401089*
```

---

<div class="post-metadata">

**Author:** ![hybridherbst](https://forum.needle.tools/user_avatar/forum.needle.tools/hybridherbst/32/3416_2.png) [@hybridherbst](https://forum.needle.tools/u/hybridherbst)\
**Post date:** [February 1, 2023, 12:00am UTC](https://forum.needle.tools/t/user-scaling-of-ar-content/296/5 "2023-02-01T00:00:00Z")

</div>

Nice, thanks for sharing!  
We’re planning to improve the whole AR UX situation in the near future 🙂

---

<div class="post-metadata">

**Author:** ![discord-import](https://forum.needle.tools/user_avatar/forum.needle.tools/discord-import/32/33_2.png) [@discord-import](https://forum.needle.tools/u/discord-import)\
**Post date:** [February 1, 2023, 12:00am UTC](https://forum.needle.tools/t/user-scaling-of-ar-content/296/6 "2023-02-01T00:00:00Z")

</div>

Big thanks @Titan. It’s much appreciated 🙂👍

_by user 908977119781060648_

---

<div class="post-metadata">

**Author:** ![discord-import](https://forum.needle.tools/user_avatar/forum.needle.tools/discord-import/32/33_2.png) [@discord-import](https://forum.needle.tools/u/discord-import)\
**Post date:** [July 10, 2023, 12:00am UTC](https://forum.needle.tools/t/user-scaling-of-ar-content/296/7 "2023-07-10T00:00:00Z")

</div>

Hi… just checking in to ask, did something like this ever get built into Needle?

If not, it’d be a ‘very nice to have’ at some point ✨ 🚀 Unless it already exists but I’ve missed it somehow? Which is entirely possible 😅

_by user 908977119781060648_

---

<div class="post-metadata">

**Author:** ![Marcel\_Wiessler1](https://forum.needle.tools/user_avatar/forum.needle.tools/marcel_wiessler1/32/21_2.png) [@Marcel\_Wiessler1](https://forum.needle.tools/u/Marcel_Wiessler1)\
**Post date:** [July 10, 2023, 12:00am UTC](https://forum.needle.tools/t/user-scaling-of-ar-content/296/8 "2023-07-10T00:00:00Z")

</div>

Hi frannie, it’s not builtin yet but we agree 🙂
