playMaker

Author Topic: Store and replicate multiple AR gameobjects positions  (Read 2133 times)

dariusp

  • Playmaker Newbie
  • *
  • Posts: 6
Store and replicate multiple AR gameobjects positions
« on: December 02, 2019, 05:59:04 PM »
Hi.

I'm needing to a very particular thing for an arts installation. Children are drawing their own flying machines on paper and adding AR sticker markers for machine parts etc.

These are scanned by a webcam, drawing captured and 3D elements added via AR. This will then captured as a game object and animated across a projection. The next child then adds their creation and so on...

I had everything working using Vuforia and Playmaker but failed to realise you can not use  Vuforia as a standalone PC or Mac application. I've now switched to EASYAR and struggling to replicate the results.

I've tried to capture the position and rotation of each AR element then create a clone and apply the coordinates to line up with a image capture of the drawing. But can't seem to get it all lined up.

I understand the world centre is set to Camera and that comes into play.

Does anyone have any advice on how to capture the position/rotation of the AR elements and reproduce as clones?

I hope this makes sense...my brain is fired.

Darius


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Store and replicate multiple AR gameobjects positions
« Reply #1 on: December 03, 2019, 01:34:59 AM »
Hi,

 yeah, all these different AR solutions makes it difficult to navigate.

 I am also shocked that vuforia doesn't support standalone, I faced the same problem last month. What an oversight on their side... it's such an unnecessary constraints...

vuforia let's you decide if the camera should move or if the objects should move, I guess you were in the mode where the camera moves. Am I correct?

you need to check the easyar doc to see if such mode exists.

else, I guess you will need to define a spot on the detected AR plane, and have all your positions using this spot as their reference, then you can move the spot around, and recreate the whole thing relative to that spot.

inverseTransformPoint action will let you express a world position into a local position ( the spot on the plane being the reference), that's what you likely need for this.

Bye,

 Jean

dariusp

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Store and replicate multiple AR gameobjects positions
« Reply #2 on: December 03, 2019, 03:43:47 AM »
Hi Jean. Thanks replying.

Yeah, had a mild panic when I realised I couldn,t Vuforia. Turns out you can do UWP but that limits use of multiple screens and USB cameras.

I think I understand. If I have a reference point in the centre of my main background plane, then tell the other objects to refer to that as its world centre?

When I Create Object (to clone) how do I tell it to refer to the new reference point? Is it a case of using GetPosition of new centre and calculating the difference?

Sorry if I'm missing the obvious

D


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Store and replicate multiple AR gameobjects positions
« Reply #3 on: December 03, 2019, 03:49:34 AM »
Hi,

 no worries, these things takes time to properly frame in your mind.

you tell it to refer to a given point in many ways.

- you can parent them all to that point, which is the easiest, because then you simply need to query their local position and they will be express relative to their direct parent

- or you have them freely in the world, and at the time of querying for their position, you use InversTransformPoint, to get the local position of that object compared to the reference object.

for you, I think parenting might make a lot of sense and be easier to deal with across the board. I do that myself for AR, I have a placeholder prefab with a shadow plane, this placeholder moves on the AR plane, then when I want to show something I instantiate it and parent it to this placeholder, then I can don't care about AR anymore, I just work inside the placeholder, and I always get a good shadow underneath, etc etc.


Bye,

 Jean

dariusp

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Store and replicate multiple AR gameobjects positions
« Reply #4 on: December 03, 2019, 07:12:28 PM »
Thanks again for your help. I still couldn't get my head around the position and relationships. However, I've managed to achieve the desired effect by placing all the AR markers and their children into a empty gameobject. I then duplicate this gameobject and disable all scripts.

Not elegant but seems to work. I just need to fix the pivot to centralised.

This is what I love about Playmaker as a non coder, I can experiment with ease.

Thanks again
Darius

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Store and replicate multiple AR gameobjects positions
« Reply #5 on: December 04, 2019, 12:46:17 AM »
Hi,

 indeed.

 your solution is like parenting indeed, so you got it. the copy/disabling seems hacky indeed, can you not save all position within a single update?

Bye,

 Jean

dariusp

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Store and replicate multiple AR gameobjects positions
« Reply #6 on: December 04, 2019, 03:52:10 AM »
Hi Jean.

I think part of the issue is because the 3D elements I want to clone from the triggerd AR get their transform data from their parent, which is the Image Tracker. From memory, I think for Vuforia it was the child that moved.

I was having to create a blank gameobject and apply the transform data to it, child the 3D object.

It seemed to work until I moved the new clone and things weren't at the right depth....

I'm not very clever at this side of things. I'm going to try the method I'm using and if I get stuck, maybe look to hire someone to help remotely. Is that a something you maybe interested in? Might just need a more experienced pair of eyes on it.

Many thanks again.
Darius

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Store and replicate multiple AR gameobjects positions
« Reply #7 on: December 12, 2019, 07:18:28 AM »
Hi,

 I am currently overwhelmed, ask Djaydino, he might be available.


Bye,

 Jean