Rotate multiple planes around a point


#1

Hi guys

Great development tool. Just getting to grips with it.

Building a 3d photo selection tool. The objective is to have the photos rotate round a centre point say vector 0 0 2.

The way I am trying to set this up is to use a group node set at 0 0 2 and have this relative to the tracking image The photos being placed at equal angles around 0 0 2 and then set to be relative to the group node.

Rotating the group node via scriptrotates the child nodes.

Is this logic sound in Studio?

The difficulty I am having is the placement of the planes which although using calculated co ordinates for their positions they are always out of position when previewed.

I may of course be having a brain fart…

Have I missed something simple?

Thank you

Cheers Pete


#2

Should work. Is your group a child of the TrackingImage?


#3

All working was a positional issue in the end

Now trying to rotate with a button press. However xxxxx.rotation([0,0,50]); sets a position and does not seem to be incremental.

Am experimenting with

parent.on(“pointerenter”, (e) => {
// Runs when pointerenter occurs on the parent node
// The argument e contains useful info about this event:
// https://docs.zap.works/studio/scripting/reference/object/events/pointerenter/

Z.every(100,Move);

});

function Move () {
const xxxx = symbol.nodes.xxxx;
Get rotation of xxxx
Increment rotation by fixed amount
Set new rotation of xxxx
}

Is there a better way though?

Cheers


#4

That’s the way. You can also check this thread:


#5

All sorted jvouillon

Will post my scripts and methods for other later

Cheers

Pete