Giter Club home page Giter Club logo

Comments (1)

tomaspietravallo avatar tomaspietravallo commented on September 26, 2024

Likely specs:

// takes in an object, and outputs it's position in the second argument's space
function transformAcrossSpaces(obj: SceneObjectBase, target: SceneObjectBase | TransformSignal): VectorSignal;

function transformAcrossSpaces(obj: VectorSignal, parentWorldTransform: TransformSignal, target: SceneObjectBase | TransformSignal): VectorSignal;

This tries to answer: "Given two Scene objects, what's the coordinate that corresponds to the position of the first value on the second coordinate space?"

Note: this may break or need to be revised in order to work with plane/target trackers, as those don't seem to be as straight forward, and often need their transform to be copied into a proxy


Edit: this works across all possible spaces/scene recognitions. Needs to be formatted into a reusable function

(async function () {
    const obj = await Scene.root.findFirst('obj');
    const debug = await Scene.root.findFirst('debug');
    const objPosInWorld = obj.parentWorldTransform.applyToPoint(obj.transform.position);
    const inDSpace = debug.parentWorldTransform.inverse().applyToPoint(objPosInWorld);
    debug.transform.position = inDSpace;
    // incorporate first obj rot into the mix by adding both QuaternionSignals πŸ‘‡
    // (this needs to be done component wise, using the Reactive API, the code below won't work)
    // debug.transform.rotation = obj.transform.rotation + debug.transform.rotation;
})();

Also tested on a plane tracker using an iPhone X, which has a transform rotation of 90ΒΊ which tends to bug coordinate transforms.

Note: you will need to reset the studio if you move scene objects in the hierarchy

from sparkar-volts.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.