Log in or register to post comments

Scripting Instantiation Position Issue

October 23, 2018 - 3:22am #1



Hello!

As it's shown at the image attached, I found an issue positioning instances of a Prefab on the go, scripting. I've made the Model Target with care about its scale and size in meters, as it's written in several places (I read a lot about this issue before opening this topic).

At the screenshot, pen's closer grey cube has been instantiated at the editor, before entering in Play Mode. It's in the right position, and always there. It doesn't move when I hit play (he's a friend :D).

Cubes in the air (top right corner in the image) should make a ring around the pen, but they didn't. They appear in a very different position than "they should": although I'm taking the center of the pen and the "editor's cube" as a reference, they change their position in every axis (Z as well).

Here come the questions:

- Where can I found the actual size and coordinates of my AR Model Object in "real time"?

- Do you have any link to an example of script-positioning for MT? (Un addition to this one: https://library.vuforia.com/content/vuforia-library/en/articles/Solution/Working-with-Vuforia-and-Unity.html)

I'm reading the documentation and find "sizes" in ModelTargetBehaviour Class, I'm trying several things, but I don't hit the nail on its head.



Thanks so much for your attention.

Best,



Virgilio

 

 

AttachmentSize
Image icon Position Issue2.PNG560.93 KB

Scripting Instantiation Position Issue

October 29, 2018 - 2:23am #2

I've got it! :D

I found the "easy" solution, finally. It was at the link I posted before, at the oficial documentation (thanks Vuforia!) but... Now I have a new issue: the advanced question. The versatile question.

Memento: I want to draw, instantiating at runtime via script, a perfect circle of objects (cubes, at the example) around a model target... This time, using as reference 2 empty's game objects transform.

I can choose a position by script, writing coordinates by hand (after subtracting them in a paper ;d) in my program, but... I would like to take the references from 2 empty game objects position.

If I get this, the script will be more versatile and I can calculate the radius of the circle with just moving one game object to the center of my circle and another game object to the perimeter... Quite faster for my final purpose: use this script to make multiple circles in multiple dimensions/orientations, just pointing a center and perimeter point.

 

Log in or register to post comments