@Override public void setPosition(float x, float y, float z) { this.x = x; this.y = y; this.z = z; super.setPosition(x, y, z); }
private void processMouseEvent(float x, float y, float z, boolean active) { GVRScene scene = context.getMainScene(); if (scene != null) { float depth = this.z; if (((depth + z) <= getNearDepth()) && ((depth + z) >= getFarDepth())) { float frustumWidth, frustumHeight; depth = depth + z; // calculate the frustum using the aspect ratio and FOV // http://docs.unity3d.com/Manual/FrustumSizeAtDistance.html float aspectRatio = scene.getMainCameraRig().getCenterCamera().getAspectRatio(); float fovY = scene.getMainCameraRig().getCenterCamera().getFovY(); float frustumHeightMultiplier = (float) Math.tan(Math.toRadians(fovY / 2)) * 2.0f; frustumHeight = frustumHeightMultiplier * depth; frustumWidth = frustumHeight * aspectRatio; this.x = frustumWidth * -x; this.y = frustumHeight * -y; this.z = depth; } setActive(active); super.setPosition(this.x, this.y, this.z); } }