Skip to content

Commit

Permalink
fix: It is not necessary to Anchor the TrackingNode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Gregat committed Jun 15, 2024
1 parent 3e35f70 commit 903cae0
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import dev.romainguy.kotlin.math.Quaternion
import io.github.sceneview.ar.ARSceneView
import io.github.sceneview.ar.arcore.createAnchorOrNull
import io.github.sceneview.ar.arcore.position
import io.github.sceneview.ar.node.AnchorNode
import io.github.sceneview.math.toRotation
import io.github.sceneview.node.ViewNode
import io.github.sceneview.sample.arviewnode.MainActivity
Expand Down Expand Up @@ -64,7 +63,6 @@ class TrackingNode(

private var isValid = ValidIndicator.IS_NOT_VALID

private var trackingAnchorNode: AnchorNode? = null
private var trackingNode: ViewNode? = null

/**
Expand Down Expand Up @@ -220,13 +218,7 @@ class TrackingNode(
setRenderable(it)
}

trackingAnchorNode = AnchorNode(
sceneView.engine,
this
)

trackingAnchorNode!!.addChildNode(trackingNode!!)
sceneView.addChildNode(trackingAnchorNode!!)
sceneView.addChildNode(trackingNode!!)
}
}
}
Expand Down Expand Up @@ -264,8 +256,8 @@ class TrackingNode(
}

getLastHitResult()?.let { hitResult ->
trackingAnchorNode?.worldPosition = hitResult.hitPose.position
trackingAnchorNode?.worldRotation = rotationMarkerVertical.toRotation()
trackingNode?.worldPosition = hitResult.hitPose.position
trackingNode?.worldRotation = rotationMarkerVertical.toRotation()
}
}

Expand Down

0 comments on commit 903cae0

Please sign in to comment.