Skip to content

Instantly share code, notes, and snippets.

View manbod's full-sized avatar

Manish Bodhankar manbod

View GitHub Profile
@manbod
manbod / AndroidManifest.xml
Created January 14, 2019 21:13
List of changes to make to a react-native package to correctly link react-viro.
<!-- Add this AndroidManifest.xml file at ViroSample/android/app/src/ovr/ only
if you are building a VR app for Samsung GearVR-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<meta-data
android:name="com.samsung.android.vr.application.mode"
android:value="vr_only"/>
</application>
@manbod
manbod / TrackedPlanesController_onAnchorFound.java
Created February 5, 2018 21:18
A TrackedPlanesController (ARScene.Listener interface implementation) that tracks planes and renders a surface on them. onAnchorFound is an interface method implemented by TrackedPlanesController
@Override
public void onAnchorFound(ARAnchor arAnchor, ARNode arNode) {
// Spawn a visual plane if a PlaneAnchor was found
if (arAnchor.getType() == ARAnchor.Type.PLANE){
ARPlaneAnchor planeAnchor = (ARPlaneAnchor)arAnchor;
// Create the visual geometry representing this plane
Vector dimensions = planeAnchor.getExtent();
Surface plane = new Surface(1,1);
plane.setWidth(dimensions.x);
@manbod
manbod / ViroARHelloWorldActivity_createDroidAtPosition.java
Created February 5, 2018 21:15
Load a 3D android model and add it to the given position
/**
* Load a 3D android model and add it to the given position
*/
private void createDroidAtPosition(Vector position){
// Create a droid on the surface
final Bitmap bot = ViroHelper.getBitmapFromAsset(this, "andy.png");
final Object3D object3D = new Object3D();
object3D.setPosition(position);
mScene.getRootNode().addChildNode(object3D);
@manbod
manbod / ViroARHelloWorldActivity_onRendererStart.java
Last active February 5, 2018 21:11
Create an AR scene that tracks planes. Clicking on a plane places a 3D Object on that spot.
/**
* Create an AR scene that tracks planes. Clicking on a plane places a 3D Object on that spot.
*/
@Override
public void onRendererStart() {
// Create the 3d ar scene, and display the point clouds.
mScene = new ARScene();
mScene.displayPointCloud(true);
// Create an TrackedPlanesController to visually display tracked planes
import {
ViroScene,
Viro360Image,
} from 'react-viro';
var RealEstateTour = React.createClass({
render: function() {
return (
<ViroScene>