0

I am trying to make a plane move according to the hand movement of the user, but I do not want the z position to change. I only want the x and y positions of the plane to change according to the position of the users' hand. Is that possible?

const Diagnostics = require('Diagnostics');
const Scene = require('Scene');
const HandTracking = require('HandTracking');

const directionalLight = Scene.root.find('directionalLight0');


const directionalLightIntensity = directionalLight.intensity;

const hand = HandTracking.hand(0);
const plane = Scene.root.find('plane0');
plane.transform = hand.cameraTransform;
yara raffoul
  • 93
  • 1
  • 11

1 Answers1

0

You can bind the hand's transform signal to the plane's X and Y axis, in this way you can control the value of the Z axis manually.

const Scene = require('Scene');
const HandTracking = require('HandTracking')

//Make sure there's a plane named like this in the scene.
const plane = Scene.root.find('plane0');
const hand = HandTracking.hand(0);

//Fixed Z value signal
const planeZ = 0;

plane.transform.x = hand.cameraTransform.position.x;
plane.transform.y = hand.cameraTransform.position.y;
plane.transform.z = planeZ;
Fall
  • 1