transformAcrossSpaces
Keep in mind that this is an advanced function that works with coordinate spaces
Parameters
vec
: a Vector signal representing the position of the object to "follow"vecParentSpace
: The parent space in whichvec
is locatedtargetParentSpace
: A TransformSignal representing the "target space", which in the absolute frame of reference
function transformAcrossSpaces(
vec: VectorSignal,
vecParentSpace: TransformSignal,
targetParentSpace: TransformSignal,
): VectorSignal
Example
With the code example below, the two objects will be placed on top of each other no matter what happens in the rest of the scene
import { transformAcrossSpaces } from './volts';
// define two SceneObjects
let firstObj: SceneObjectBase, secondarySceneObj: SceneObjectBase;
// make both objects be in the same position
// obj2 is placed on top of obj1
secondarySceneObj.transform.position =
transformAcrossSpaces(
firstObj.transform.position,
firstObj.parentWorldTransform,
secondarySceneObj.parentWorldTransform
);
Last updated
Was this helpful?