Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instantiating a Clone w/ TapToPlace as a Component #567

Closed
mattfedocsg opened this issue Mar 15, 2017 · 2 comments
Closed

Instantiating a Clone w/ TapToPlace as a Component #567

mattfedocsg opened this issue Mar 15, 2017 · 2 comments
Labels

Comments

@mattfedocsg
Copy link

I am not sure if this is "by design", but if you have an object that has TapToPlace.cs added as a component, with a saved friendly anchor name specified and then go to instantiate a clone, the clones position and anchor matches that of the original object. Even if you try to instantiate the object with a new pos and rot. I assume because the position is saved by anchor.

I fixed this on my end by instantiating the object, changing the anchor name, attaching the anchor to the WorldAnchorManager, then changing the position and rotation.

I feel like the script should have done this for me though. Maybe check to see if the world anchor store already has that key anchor name? Then at on destroy remove the anchor that was cloned?

I guess it is just my opinion, but anyone else have any thoughts? Or maybe I am missing something? Thanks!

@mattfedocsg
Copy link
Author

mattfedocsg commented Mar 21, 2017

If anyone is having issues with this, I've just been updating the friendly name with the date down to the second or millisecond that the object was instantiated. Then, in best gaming practice, throw that object in a pool. So instantiate the object with a new position, change the anchor name, and attach the anchor. Done.

GameObject gameObject= GameObject.Instantiate(OriginalObject, pos, rot);

gameObject.GetComponent<TapToPlace>().SavedAnchorFriendlyName = "gameObject_" + System.DateTime.Now.ToString("yyyyMMddhhmmss");

WorldAnchorManager.Instance.AttachAnchor(gameObject, gameObject.GetComponent<TapToPlace>().SavedAnchorFriendlyName);

@StephenHodgson
Copy link
Contributor

@mattfedocsg With the latest PR You would just need to make sure the GameObject names are unique.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants