public void setRotationByAxis(float angle, float x, float y, float z) { layoutSceneObject.getTransform().setRotationByAxis(angle, x, y, z); }
public void setRotationByAxis(float angle, float x, float y, float z) { layoutSceneObject.getTransform().setRotationByAxis(angle, x, y, z); }
public static void lookAtYAxis(GVRSceneObject origin, GVRSceneObject destination) { origin.getTransform().setRotationByAxis( MathUtils.getYRotationAngle(origin, destination), 0, 1, 0); }
protected void cleanRotation() { getTransform().setRotationByAxis(0, 1.0f, 0, 0); spinnerAdapter.clean(); }
public ActionWormAnimation(GVRContext gvrContext) { super(gvrContext); Resources res = gvrContext.getContext().getResources(); String clearButtonText = res.getString(R.string.clear_button); playButton = new AnimButtonPlay(gvrContext); cleanButton = new AnimCleanButton(gvrContext, clearButtonText); playButton.getTransform().setPosition(0, 0, 0); playButton.getTransform().setRotationByAxis(16, 0, 1, 0); cleanButton.getTransform().setPosition(0, CLEARBUTTON_POSITIONY, 0); cleanButton.getTransform().setRotationByAxis(5f, 0, 1, 0); getTransform().setPositionY(MINIMUM_Y_POSITION); attachActionButtons(); }
public StarBoxSceneObject(GVRContext gvrContext) { super(gvrContext); Resources res = gvrContext.getContext().getResources(); String clearButtonText = res.getString(R.string.clear_button); createStar(); playButton = new AnimButtonPlay(gvrContext); cleanButton = new AnimCleanButton(gvrContext, clearButtonText); float starX = star.getTransform().getPositionX(); float starY = star.getTransform().getPositionY(); playButton.getTransform().setPosition(starX, starY - PLAYBUTTON_OFFSET, 0); playButton.getTransform().setRotationByAxis(180, 0, 1, 0); cleanButton.getTransform().setPosition(starX, starY - CLEARBUTTON_OFFSET, 0); cleanButton.getTransform().setRotationByAxis(180, 0, 1, 0); attachActionButtons(); }
private void createGallery() { gallery = new Gallery(getGVRContext(), photos); gallery.getTransform().setPosition(Gallery.GALLERY_POSITION_X, Gallery.GALLERY_POSITION_Y, Gallery.GALLERY_POSITION_Z); gallery.getTransform().setRotationByAxis(180.0f, 0f, 1f, 0f); scene.addSceneObject(gallery); }
private void addRotaionGroup(GVRContext gvrContext) { rotationGroup = new RotationGroup(gvrContext); rotationGroup.getTransform().setRotationByAxis(10, 1, 0, 0); rotationGroup.getTransform().setPositionZ(0.6f); rotationGroup.getTransform().setPositionY(GROUP_Y_POSITION); }
@Override public void onInit(GVRContext gvrContext) throws IOException { mGVRContext = gvrContext; GVRScene scene = gvrContext.getMainScene(); scene.getMainCameraRig().getTransform().setPosition(0,0,0); //attach the stars emitter initially stars = createstars(); stars.getTransform().setPosition(0,0,-50); stars.getTransform().setRotationByAxis(90, 1,0,0); scene.addSceneObject(stars); mElapsedTime = System.currentTimeMillis(); }
private GVRSceneObject addStormtrooper(GVRScene scene, float x, float y, float z) throws IOException { GVRSceneObject model = mGVRContext.getAssetLoader().loadModel("storm.obj", scene); model.getTransform().setPosition(x, y, z); model.getTransform().setScale(1.5f, 1.5f, 1.5f); model.getTransform().setRotationByAxis((float) -90, 0, 1, 0); return model; }
private void addGroundMesh(GVRScene scene, float x, float y, float z, float mass) { try { GVRTexture texture = mGVRContext.getAssetLoader().loadTexture(new GVRAndroidResource(mGVRContext, "floor.jpg")); GVRSceneObject meshObject = new GVRSceneObject(mGVRContext, 100.0f, 100.0f, texture); meshObject.getTransform().setPosition(x, y, z); meshObject.getTransform().setRotationByAxis(-90.0f, 1.0f, 0.0f, 0.0f); // Collider GVRMeshCollider meshCollider = new GVRMeshCollider(mGVRContext, false); meshObject.attachCollider(meshCollider); // Physics body GVRRigidBody body = new GVRRigidBody(mGVRContext); body.setRestitution(0.5f); body.setFriction(1.0f); meshObject.attachComponent(body); scene.addSceneObject(meshObject); } catch (IOException exception) { Log.d("gvrf", exception.toString()); } }
private void createDinosaur() { ankylosaurus = DinosaurFactory.getInstance(getGVRContext()).getAnkylosaurus(); ankylosaurus.getTransform().setRotationByAxis(-90, 1, 0, 0); ankylosaurus.attachCollider(new GVRMeshCollider(getGVRContext(), true)); ankylosaurus.setOnGestureListener(this); ankylosaurus.setName("ankylosaurus"); addChildObject(ankylosaurus); }
private void createDinosaur() { trex = DinosaurFactory.getInstance(getGVRContext()).getTRex(); trex.attachCollider(new GVRMeshCollider(getGVRContext(), true)); trex.setOnGestureListener(this); trex.getTransform().setRotationByAxis(-90, 1, 0, 0); trex.setName("trex"); addChildObject(trex); }
private GVRSceneObject createDirectLight(GVRContext context) { GVRSceneObject lightNode = new GVRSceneObject(context); GVRDirectLight light = new GVRDirectLight(context); light.setCastShadow(true); lightNode.attachLight(light); light.setShadowRange(1.0f, 150.0f); lightNode.getTransform().setRotationByAxis(-70, 1, 0, 0); light.setAmbientIntensity(0.3f, 0.3f, 0.3f, 1); light.setDiffuseIntensity(1, 1, 1, 1); light.setSpecularIntensity(1, 1, 1, 1); light.setShadowRange(1f, 150.0f); lightNode.setName("DirectLight"); return lightNode; }
private void createSun() { GVRMesh mesh = mGVRContext.createQuad(SUN_SIZE, SUN_SIZE); GVRTexture texture = mGVRContext.getAssetLoader().loadTexture( new GVRAndroidResource(mGVRContext, R.drawable.sun)); sun = new GVRSceneObject(mGVRContext, mesh, texture); sun.getTransform().setRotationByAxis(90, 1, 0, 0); sun.getTransform().setPositionY(SUN_Y_POSITION); sun.getTransform().rotateByAxisWithPivot(SUN_ANGLE_POSITION, 1, 0, 0, 0, 0, 0); sun.getRenderData().setRenderingOrder(RenderingOrder.SUN); sun.setName("sun"); scene.addSceneObject(sun); }
public GVRSceneObject createPlane(GVRContext gvrContext) { GVRSceneObject plane = new GVRSceneObject(gvrContext); GVRMesh mesh = GVRMesh.createQuad(gvrContext, "float3 a_position", 1.0f, 1.0f); GVRMaterial mat = new GVRMaterial(gvrContext, GVRMaterial.GVRShaderType.Phong.ID); GVRSceneObject polygonObject = new GVRSceneObject(gvrContext, mesh, mat); Vector4f color = mColors[mPlaneIndex % mColors.length]; plane.setName("Plane" + mPlaneIndex); polygonObject.setName("PlaneGeometry" + mPlaneIndex); mPlaneIndex++; mat.setDiffuseColor(color.x, color.y, color.x, color.w); polygonObject.getRenderData().setAlphaBlend(true); polygonObject.getRenderData().disableLight(); polygonObject.getTransform().setRotationByAxis(-90, 1, 0, 0); plane.addChildObject(polygonObject); return plane; }
private GVRSceneObject createSpotLight(GVRContext context) { GVRSceneObject lightNode = new GVRSceneObject(context); GVRSpotLight light = new GVRSpotLight(context); light.setCastShadow(true); lightNode.attachLight(light); lightNode.getTransform().setRotationByAxis(-35, 1, 0, 0); lightNode.getTransform().setPosition(-4, 7, 10); light.setAmbientIntensity(0.3f, 0.3f, 0.3f, 1); light.setDiffuseIntensity(1, 1, 1, 1); light.setSpecularIntensity(1, 1, 1, 1); light.setInnerConeAngle(40); light.setOuterConeAngle(55); light.setShadowRange(0.2f, 100.0f); lightNode.setName("SpotLight"); return lightNode; }
public GVRSceneObject createQuadPlane(GVRContext gvrContext) { GVRSceneObject plane = new GVRSceneObject(gvrContext); GVRMesh mesh = GVRMesh.createQuad(gvrContext, "float3 a_position", 1.0f, 1.0f); GVRMaterial mat = new GVRMaterial(gvrContext, GVRMaterial.GVRShaderType.Phong.ID); GVRSceneObject polygonObject = new GVRSceneObject(gvrContext, mesh, mat); Vector4f color = mColors[mPlaneIndex % mColors.length]; plane.setName("Plane" + mPlaneIndex); polygonObject.setName("PlaneGeometry" + mPlaneIndex); mPlaneIndex++; mat.setDiffuseColor(color.x, color.y, color.x, color.w); polygonObject.getRenderData().disableLight(); polygonObject.getRenderData().setAlphaBlend(true); polygonObject.getRenderData().setRenderingOrder(GVRRenderData.GVRRenderingOrder.TRANSPARENT); polygonObject.getTransform().setRotationByAxis(-90, 1, 0, 0); plane.addChildObject(polygonObject); return plane; }
public void playMoveAnimation(GVRContext gvrContext, GVRSceneObject returnTarget) { getTransform().setPosition(returnTarget.getTransform().getPositionX(), returnTarget.getTransform().getPositionY(), returnTarget.getTransform().getPositionZ()); getTransform().setRotationByAxis( 0, 1, 1, 1); getTransform().rotateByAxis( MathUtils.getYRotationAngle(this, gvrContext.getMainScene().getMainCameraRig()), 0, 1, 0); GVRAnimation anim = new GVRRelativeMotionAnimation(this, ANIMATION_DURATION, 0, Y_ANIMATION_DELTA, 0); anim.start(gvrContext.getAnimationEngine()); playOpacityAnimation(gvrContext); }
public static GVRSceneObject createCylinder(GVRContext context, float x, float y, float z, int drawable) throws IOException { GVRTexture texture = context.getAssetLoader().loadTexture(new GVRAndroidResource(context, drawable)); GVRMaterial mtl = new GVRMaterial(context, GVRMaterial.GVRShaderType.Phong.ID); GVRMesh mesh = context.getAssetLoader().loadMesh(new GVRAndroidResource(context, "cylinder.fbx")); GVRSceneObject cylinderObject = new GVRSceneObject(context, mesh, mtl); cylinderObject.getTransform().setPosition(x, y, z); cylinderObject.getTransform().setRotationByAxis(90.0f, 1.0f, 0.0f, 0.0f); mtl.setTexture("diffuseTexture", texture); // Collider GVRMeshCollider meshCollider = new GVRMeshCollider(context, false); cylinderObject.attachCollider(meshCollider); // Physics body GVRRigidBody body = new GVRRigidBody(context, CYLINDER_MASS, COLLISION_GROUP_CYLINDER); body.setRestitution(0.5f); body.setFriction(5.0f); cylinderObject.attachComponent(body); return cylinderObject; }