Log in or register to post comments

GameObject between 2 ImageTargets

July 9, 2018 - 7:34am #1

Hello everyone.

I really need a help. I've been searching for any way to realize my idea for a week or more...

。゚・ (>﹏<) ・゚。

What I need: I have 2 ImageTargets; if web camera detects both images, my script is being launched and it sets a GameObject active (panel.SetActive(true)). And this object should be placed right BETWEEN this Image Targets. That's all what I need.

What I tried:

  • I tried to find images' coordinates using .WorldToScreenPoint():

Vector3 target1OnScreenPosition = cam.WorldToScreenPoint(target1.transform.position);

panel.transform.position = new Vector3(-deltaX / 2, 0, deltaY / 2);

// Axis are right. I checked. I hope it's needless to say what is deltaX and deltaY, yep?

But world coords don't equal screen coords. So I've used also .ScreenToWorldPoint() and I made some coefficient of coords.

panel.transform.position = new Vector3(-WTSdeltaX /(WTSdeltaX/STWdeltaX), 0, WTSdeltaY / (WTSdeltaX/STWdeltaX));

But heck no! GameObject is slightly lefter and higher from center! (μ_μ)

  • I tried to create another target when web cam detects images. I've been watching Youtube videos, Vuforia's tutorials and documentation. And nothing. I tried Ground Plane and Mid Air (but they need a smartphone, otherwise you must use GroundMark), Cuboid (it's useless for me), Camera Image (I can't search info about this! O_o), and no result.

I... I tired of my empty attempts. I can only cal for a help. Thanks to everyone who will help me!

GameObject between 2 ImageTargets

July 12, 2018 - 11:30pm #2

I finally did this! I don't need help anymore with this problem.

If you need a solution, let me know, but for now I think it's needless to discribe my code.

Log in or register to post comments