CS-Senior-Project / AR-Collaboration

CS13: AR collaboration for PCB analysis with VR and Zed Mini
2 stars 1 forks source link

Place Cube Function #2

Closed PembleC closed 4 years ago

PembleC commented 4 years ago

In the Main assets folder is a C# script that doesn't work. The idea is from the stereo labs page "https://www.stereolabs.com/docs/unity/object-placement/" but their code is outdated. Need to find a new way to place objects on command and the location of the mouse position.

miurary commented 4 years ago

void Update () { if(Input.GetMouseButtonDown(0)) { Vector2 screenpos = new Vector2(Input.mousePosition.x, Input.mousePosition.y); Vector3 worldpos; if(ZEDSupportFunctions.GetWorldPositionAtPixel(screenpos, ZEDManager.Instance.GetLeftCameraTransform().GetComponent<Camera>(), out worldpos)) { GetComponent<Rigidbody>().velocity = Vector3.zero; transform.position = worldpos + Vector3.up; } } }

You're talking about this code, right?

PembleC commented 4 years ago

Finished a while ago with the new Input2.0 Scene. Look at MyActionScript for a sample of how to create game objects based off of user controller input.