<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://dbbd.sg/wiki/index.php?action=history&amp;feed=atom&amp;title=Unity_AR_Butterfly</id>
		<title>Unity AR Butterfly - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://dbbd.sg/wiki/index.php?action=history&amp;feed=atom&amp;title=Unity_AR_Butterfly"/>
		<link rel="alternate" type="text/html" href="http://dbbd.sg/wiki/index.php?title=Unity_AR_Butterfly&amp;action=history"/>
		<updated>2026-05-06T17:27:45Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.27.4</generator>

	<entry>
		<id>http://dbbd.sg/wiki/index.php?title=Unity_AR_Butterfly&amp;diff=11152&amp;oldid=prev</id>
		<title>WikiSysop: Created page with &quot;Attended the &quot;Create Augmented Reality App&quot; Webinar by Gen In finiti Academy, 13 Aug 2020, 7.30pm-9.30pm - Conducted by Emmanual Tay  * Change build settings to Android/mobile...&quot;</title>
		<link rel="alternate" type="text/html" href="http://dbbd.sg/wiki/index.php?title=Unity_AR_Butterfly&amp;diff=11152&amp;oldid=prev"/>
				<updated>2020-09-05T00:55:24Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Attended the &amp;quot;Create Augmented Reality App&amp;quot; Webinar by Gen In finiti Academy, 13 Aug 2020, 7.30pm-9.30pm - Conducted by Emmanual Tay  * Change build settings to Android/mobile...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Attended the &amp;quot;Create Augmented Reality App&amp;quot; Webinar by Gen In finiti Academy, 13 Aug 2020, 7.30pm-9.30pm&lt;br /&gt;
- Conducted by Emmanual Tay&lt;br /&gt;
&lt;br /&gt;
* Change build settings to Android/mobile&lt;br /&gt;
* Delete Main camera and Directional Light&lt;br /&gt;
* Window &amp;gt; Package Manager &amp;gt; AR Foundation &amp;gt; Install&lt;br /&gt;
* Window &amp;gt; Package Manager &amp;gt; ARCore XD Plugin &amp;gt; Install&lt;br /&gt;
* Window &amp;gt; Package Manager &amp;gt; ARkit Xr Plugin &amp;gt; Install&lt;br /&gt;
* Rightclick on Hierarchy Window &amp;gt; XR &amp;gt; AR Session origin&lt;br /&gt;
* Double click the tiny AR Session origin &amp;gt; look under inspector &amp;gt; tag: MainCamera&lt;br /&gt;
* Rightclick on Hierarchy Window &amp;gt; XR &amp;gt; AR Session (coordinates the real world)&lt;br /&gt;
* Rightclick on Hierarchy Window &amp;gt; XR &amp;gt; AR Default Plane&lt;br /&gt;
* Click on AR Session Origin in Hierarchy &amp;gt; Look in Inspector &amp;gt; Add Component &amp;gt; AR Raycast Manager (checks for floor)&lt;br /&gt;
* Click on AR Session Origin in Hierarchy &amp;gt; Look in Inspector &amp;gt; Add Component &amp;gt; AR Plane Manager (allows you to tag and project things)&lt;br /&gt;
* Now we want to add a plane prefab, first we create a folder in project called “prefabs”&lt;br /&gt;
* Drag the AR Default Plane into the Prefabs folder&lt;br /&gt;
* Drag the blue AR Default Prefab into inspector slot for AR Session Origin &amp;gt; plane manager &amp;gt; plane prefab&lt;br /&gt;
* Create in project a scripts folder&lt;br /&gt;
* Create a new C# script “PlaceOnPlane.cs” - open it in editor of choice (be careful about naming of file)&lt;br /&gt;
* Drag and drop PlaceOnPlane script into AR session origin&lt;br /&gt;
* Download free asset butterfly (just go to Asset Store and look for the free Animated Butterly asset&lt;br /&gt;
* Download and import the butterfly asset - THIS ONE: https://assetstore.unity.com/packages/3d/characters/animals/butterfly-animated-58355&lt;br /&gt;
* Newly imported Butterfly asset folder &amp;gt; Double click on FBX &amp;gt; Double click on Materials&lt;br /&gt;
* Select second sphere (blue metallic) butterfly_Albedo &amp;gt; select the image material in emissions (otherwise butterfly will not show up)&lt;br /&gt;
* Assets &amp;gt; Butterfly Animated &amp;gt; Prefab &amp;gt; left click on butterfly and drag it inside Place On Place Model (inside AR Session Origin)&lt;br /&gt;
* Project Settings &amp;gt; Player &amp;gt; Other setting &amp;gt; Identification &amp;gt; Minimum API Level &amp;gt; Set to Android 7.1&lt;br /&gt;
* Build and Run&lt;br /&gt;
* Copy the apk to your phone&lt;br /&gt;
* Recklessly install it on your phone&lt;br /&gt;
* AR BUTTERFLY APP COMPLETE&lt;br /&gt;
&lt;br /&gt;
[[File:butterflyARapp.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== PlaceOnPlane.cs ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
using UnityEngine.XR.ARFoundation;&lt;br /&gt;
using UnityEngine.EventSystems;&lt;br /&gt;
&lt;br /&gt;
public class PlaceOnPlane : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
    ARRaycastManager raycastManager;&lt;br /&gt;
    List&amp;lt;ARRaycastHit&amp;gt; hits;&lt;br /&gt;
&lt;br /&gt;
    public GameObject model;&lt;br /&gt;
    &lt;br /&gt;
    void Start()&lt;br /&gt;
    {&lt;br /&gt;
        raycastManager = GetComponent&amp;lt;ARRaycastManager&amp;gt;();&lt;br /&gt;
        hits = new List&amp;lt;ARRaycastHit&amp;gt;();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Update is called once per frame&lt;br /&gt;
    void Update()&lt;br /&gt;
    {&lt;br /&gt;
        if (Input.touchCount == 0)&lt;br /&gt;
            return;&lt;br /&gt;
&lt;br /&gt;
        Touch touch = Input.GetTouch(0);&lt;br /&gt;
&lt;br /&gt;
        if (IsPointerOverUIObject(touch.position))&lt;br /&gt;
            return;&lt;br /&gt;
&lt;br /&gt;
        if (raycastManager.Raycast(touch.position, hits))&lt;br /&gt;
        {&lt;br /&gt;
            Pose pose = hits[0].pose;&lt;br /&gt;
&lt;br /&gt;
            Instantiate(model, pose.position, pose.rotation);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    bool IsPointerOverUIObject(Vector2 pos)&lt;br /&gt;
    {&lt;br /&gt;
        if (EventSystem.current == null)&lt;br /&gt;
            return false;&lt;br /&gt;
        PointerEventData eventDataCurrentPosition = new PointerEventData(EventSystem.current);&lt;br /&gt;
        eventDataCurrentPosition.position = new Vector2(pos.x, pos.y);&lt;br /&gt;
        List&amp;lt;RaycastResult&amp;gt; results = new List&amp;lt;RaycastResult&amp;gt;();&lt;br /&gt;
        EventSystem.current.RaycastAll(eventDataCurrentPosition, results);&lt;br /&gt;
        return results.Count &amp;gt; 0;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>	</entry>

	</feed>