Git Product home page Git Product logo

ar-ane's Introduction

Adobe AIR + ARKit

ARKit Adobe Air Native Extension for iOS 11.0+ This ANE provides bindings for the ARKit API

ASDocs Documentation


Much time, skill and effort has gone into this. Help support the project

paypal


Prerequisites

You will need:

The ANE + Dependencies

Change directory into the example folder eg

cd /MyMac/dev/AIR/AR-ANE/example

Run the "air-tools" command (You will need AIR-Tools installed)

air-tools install

NEW This tool now:

  1. Downloads the AdMobANE and dependencies.
  2. Applies all required Android Manifest, InfoAdditons and Entitlements to your app.xml. See air package.json

N.B. You must use a Mac to build an iOS app using this ANE. Windows is NOT supported.

iOS: Packaging Frameworks Dependencies

The iOS ANEs are written in Swift. We need to package the Swift libraries (along with a couple of dynamic frameworks) with our AIR app

https://raw.githubusercontent.com/wiki/tuarua/Firebase-ANE/images/frameworks-package.png


Getting Started

Firstly, familiarise yourself with the concepts of Apple's ARKit. This ANE is at its core a binding for the ARKit APIs.

Usage

arkit = ARANE.arkit;
if (!arkit.isSupported) {
    trace("ARKIT is NOT Supported on this device");
    return;
}

arkit.view3D.showsStatistics = false;
arkit.view3D.automaticallyUpdatesLighting = true;
arkit.view3D.antialiasingMode = AntialiasingMode.multisampling4X;
arkit.view3D.init();
var config:WorldTrackingConfiguration = new WorldTrackingConfiguration();
if (arkit.iosVersion >= 11.3) {
    config.planeDetection = [PlaneDetection.horizontal, PlaneDetection.vertical];
} else {
    config.planeDetection = [PlaneDetection.horizontal];
}
arkit.view3D.session.run(config, [RunOptions.resetTracking, RunOptions.removeExistingAnchors]);

Geometries

The following geometries based on their SCNKit equivalents are available: Box, Sphere, Capsule, Cone, Cylinder, Plane, Pyramid, Torus, Tube

var cone:Cone = new Cone(0, 0.05, 0.1);
var node:Node = new Node(cone);
arkit.view3D.scene.rootNode.addChildNode(node);

Materials

Materials can be supplied as:
ARGB uint
BitmapData
String path to image file

box.firstMaterial.diffuse.contents = ColorARGB.RED;

sphere.firstMaterial.diffuse.contents = "materials/globe.png";

//supply 6 materials for 6 sides of box
box.materials = new <Material>[redMat, greenMat, blueMat, yellowMat, brownMat, whiteMat];

Physics

var box:Box = new Box(0.1, 0.1, 0.1);
box.firstMaterial.diffuse.contents = ColorARGB.ORANGE;
var boxNode:Node = new Node(box);
var boxShape:PhysicsShape = new PhysicsShape(box);
var physicsBody:PhysicsBody = new PhysicsBody(PhysicsBodyType.dynamic, boxShape);
physicsBody.allowsResting = true;

boxNode.physicsBody = physicsBody;
boxNode.position = new Vector3D(0, 0.5, 0);

arkit.view3D.scene.rootNode.addChildNode(boxNode);

Detecting Planes

arkit = ARANE.arkit;
if (arkit.iosVersion >= 11.3) {
    config.planeDetection = [PlaneDetection.horizontal, PlaneDetection.vertical];
} else {
    config.planeDetection = [PlaneDetection.horizontal];
}
arkit.addEventListener(PlaneDetectedEvent.ON_PLANE_DETECTED, onPlaneDetected);

private function onPlaneDetected(event:PlaneDetectedEvent):void {
    var planeAnchor:PlaneAnchor = event.anchor;
    var node:Node = event.node;
    
    var plane:Box = new Box(planeAnchor.extent.x, planeAnchor.extent.z, 0);
    var gridTexture:String = "materials/grid.png";
    plane.firstMaterial.diffuse.contents = gridTexture;
    
    var planeNode:Node = new Node(plane);
    planeNode.position = new Vector3D(planeAnchor.center.x, 0, planeAnchor.center.z)
    var boxShape:PhysicsShape = new PhysicsShape(plane);
    planeNode.physicsBody = new PhysicsBody(PhysicsBodyType.static, boxShape);
    planeNode.eulerAngles = new Vector3D(-Math.PI / 2, 0, 0);
    node.addChildNode(planeNode);
}

Camera Tracking

arkit = ARANE.arkit;
arkit.addEventListener(CameraTrackingEvent.ON_STATE_CHANGE, onCameraTrackingStateChange);

private function onCameraTrackingStateChange(event:CameraTrackingEvent):void {
    switch (event.state) {
        case TrackingState.notAvailable:
            break;
        case TrackingState.normal:
            break;
        case TrackingState.limited:
            switch (event.reason) {
                case TrackingStateReason.excessiveMotion:
                    break;
                case TrackingStateReason.initializing:
                    break;
                case TrackingStateReason.insufficientFeatures:
                    break;
                case TrackingStateReason.relocalizing:
                    break;
            }
            break;
    }
}

Detecting Touches

arkit = ARANE.arkit;
arkit.addEventListener(TapEvent.ON_SCENE3D_TAP, onSceneTapped);
private function onSceneTapped(event:TapEvent):void {
    if (event.location) {
        // look for planes
        var arHitTestResult:ARHitTestResult = arkit.view3D.hitTest3D(event.location, [HitTestResultType.existingPlaneUsingExtent]);
        if (arHitTestResult) {
            // plane tapped
        }
        
        var hitTestResult:HitTestResult = arkit.view3D.hitTest(event.location, new HitTestOptions());
        trace("hitTestResult", hitTestResult);
        if (hitTestResult) {
            // node tapped on
        }
    }
}

Running on Simulator

ARKit won't run on the simulator

Running on Device

The example project can be run on the device from IntelliJ using AIR 32.

Issues

The Issues section is for bugs and API requests only.
Use the supplied template or the ticket will be closed.
Paid Premium support is available.

Contributing

If you have knowledge of ARKit contributions are welcome. This includes adding documentation, sample code and Scenekit models.
Likewise, sponsorship or donations will go a long way to pushing the ANE further along.

Prerequisites

You will need:

  • a Mac. Windows is not supported
  • an iOS device with an A9 or later processor
  • IntelliJ IDEA / Flash Builder
  • AIR 33.0.2.338+
  • Xcode 11.3
  • wget on macOS via brew install wget

Task List

  • Planes
    • Horizontal Plane Detection
    • Vertical Plane Detection (iOS 11.3)
    • Plane Updates
    • Plane Removal
    • Apple Sample 'Focus Square'
  • Geometry
    • Box
    • Capsule
    • Cone
    • Cylinder
    • Plane
    • Pyramid
    • Shape (from SVG)
    • Sphere
    • Models
      • from .scn
      • from .dae
    • Text
    • Torus
    • Tube
  • Lighting
  • Materials
    • Colour
    • Image
    • BitmapData
  • Physics
    • Body
    • Collision Events
    • Vehicle
  • Animation
  • Camera
    • Tracking
    • Autofocus (iOS 11.3)
  • Touch
    • Tap
    • Swipe
    • Pinch
    • Long Press
  • Permissions
    • Camera
  • Hit Test
    • Planes
    • Nodes
  • Image Detection
    • AR Reference images (iOS 11.3)
  • Object Detection
    • AR Reference object (iOS 12.0)

References

ar-ane's People

Contributors

tuarua avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ar-ane's Issues

Demo app force close when launching in iPhone

Answer the below. DO NOT DELETE!!

  • What experience do you have with ARKit?
    none

  • Have you read the README carefully?
    yes

  • What version of the product are you using?
    0.02

  • On what operating system?
    OSX

  • Which IDE are you using?
    IntelliJ

  • Which version of AIR are you using?
    same results on 29 and 30 (beta)

  • What steps will reproduce the problem?
    simple hello world project, just with the ane file, ios_dependencies folder, and the ARANE.swc

  • What is the expected output? What do you see instead?
    build is sucessfully, but the ipa force closes when lauching in mobile device,

  • Please provide any additional information below.
    also tried to compile in animate CC with the same results, if I remove the ANE file it works just fine.

thanks in advance

Simplified version of the ANE

Answer the below. DO NOT DELETE!!

  • What experience do you have with ARKit?

    • I tested it on Unity. Trying to make it work on Adobe AIR now.
  • Have you read the README carefully?

    • Yes, This is not about the implementation.
  • What version of the product are you using?

    • 0.0.6
  • On what operating system?

    • Win10
  • Which IDE are you using?

    • Flash Develop
  • Which version of AIR are you using?

    • 28/29
  • What steps will reproduce the problem?

    • No problem, just a feature request.
  • What is the expected output? What do you see instead?
    -No problem, just a feature request

  • Please provide any additional information below.

    • No problem, just a feature request.

I would like to know if you can create a version of the ANE that it's totally independent from the actual rendering. We are using Flare3D. I assume that the only thing that I need is the 3d camera matrix so I can replicate that with flare3d's camera and the matrices of the planes that the ANE detects.

Do you think that it could be possible?

Convert local coordinate to world coordinate

Answer the below. DO NOT DELETE!!

  • What experience do you have with ARKit?

    • None
  • Have you read the README carefully?
    -Yes

  • What version of the product are you using?

    • What version are you using?
      e.g. 0.5.0
  • On what operating system?

    • OSX
  • Which IDE are you using?
    -Flash Animate

  • Which version of AIR are you using?

    • 29
  • What steps will reproduce the problem?

    • I have to position the model based on local coordinate of the device.How do i do that?
      Also how do I convert local coordinates to world coordinates?
  • What is the expected output? What do you see instead?

  • Please provide any additional information below.

    • A stack trace if available, any Exception information.Screengrabs.

Add AR-ANE to existing application which supports iOS version 7.0 and above

Answer the below. DO NOT DELETE!!

  • What experience do you have with ARKit?

    • Some experience.
  • Have you read the README carefully?

    • Yes
  • What version of the product are you using?

    • What version are you using?
    • 0.3.0
  • On what operating system?
    -OS X 10.13.5

  • Which IDE are you using?
    -Flash Animate CC

  • Which version of AIR are you using?
    -AIR 30.0.0107.

  • What steps will reproduce the problem?

    • Try building application with minimumOSVersion 7.0. It gives me “MinimumOSVersion passed in app-xml is less than supported version, ignoring MinimumOSVersion value” error.
  • What is the expected output? What do you see instead?
    The application should run on every device with iOS version 7.0 and above with AR component disabled on device with iOS version below 11.0 and enabled on iOS version 11.0 and above.

Currently it is not letting me publish app if i keep the minimum version below 11.0.

  • Please provide any additional information below.
    I have an AIR application in iOS which currently runs on MinimumOSVersion 7.0. I want to add this AR ANE to my existing application. AR component will be visible only to devices with iOS 11.0 and above.
    If I change the MinimumOSVersion to 7.0 in descriptor file it gives me following error while publishing “MinimumOSVersion passed in app-xml is less than supported version, ignoring MinimumOSVersion value”.
    If I remove this two lines
    MinimumOSVersion
    11.0
    it gives me “Error: libARANE.a are required to have universal iOS libraries. Please contact the ANE developer(s) to get the same.”
    How do I add AR ANE so that it can run in my existing app supporting devices with iOS 7.0 and above.

libARANE.a are required to have universal iOS librararies

Answer the below. DO NOT DELETE!!

  • What experience do you have with ARKit?

    • none
  • Have you read the README carefully?

    • yes
  • What version of the product are you using?

    • What version are you using?
      0.2.0
  • On what operating system?

    • OSX
  • Which IDE are you using?

    • IntelliJ,
  • Which version of AIR are you using?
    -30

  • What steps will reproduce the problem?

  • What is the expected output? What do you see instead?

  • Please provide any additional information below.

When I comile my app I see this error ;

1

I read your readme carefully and set framewors (like vibration ANE) and download ANE, assets and refrence_images as you can see in this pictures:

2
3

Issue while adding animated Alembic(.abc) file

Answer the below. DO NOT DELETE!!

  • What experience do you have with ARKit?
    Some

  • Have you read the README carefully?
    Yes

  • What version of the product are you using?

    • What version are you using?
      e.g. 0.3.0
  • On what operating system?
    -OS X 10.13.5

  • Which IDE are you using?
    Animate CC

  • Which version of AIR are you using?
    AIR 30.

  • What steps will reproduce the problem?

    • Adding animated Alembic(.abc) file
  • What is the expected output? What do you see instead?
    When i load .abc file without animation it gets loaded properly with texture wrapped around it but when i load .abc with frame animation, it gets loaded but stops on first frame. Also i cannot wrap texture to it.
    -How do i load .abc file with frame animation?
    -Is there any other format which supports animation in AR?

  • Please provide any additional information below.

    • A stack trace if available, any Exception information.Screengrabs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.