Comments (1)
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)
- Better Vector types HOT 1
- Cloth/chain simulation
- Writeable signals HOT 1
- Breaking changes: Object3D HOT 2
- Feature request: Vector.swizzle
- OBB Collision response HOT 2
- Test driven development - Jest HOT 1
- Persistent data storage
- Camera UV 2 WorldSpace HOT 3
- Physics HOT 5
- Dynamic snapshots HOT 2
- Mock modules - Jest HOT 1
- Add link Issue URL HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sparkar-volts.