Open felixchang123 opened 6 years ago
Hi, @felixchang123
Maybe, You should apply model view matrix of device pose to SCNCamera, and apply matrix which multiplied camera's matrix and anchor's modelview matrix to 3d models which correspond to anchors.
I wonder Ground Plane Sample at Vuforia Dev Site is very useful for you.
Hi @yshrkt, I would like to show the 3d ground plane, but it wasn't work The mReticlePose modelview matrix is given by hitting result from smart terrain. I followed the ground plane example, to retrieve 3d plane modelview by multiplying device pose with reticle's pose. And invert it back to SceneKit SCNCamera. However, I can't see anything (SCNScene), is something wrong ? BTW, how can I set modelview matrix from anchor into 3d model directly ? Thanks for your help!
const Vuforia::TrackableResult* result = state.getTrackableResult(i);
if(result->isOfType(Vuforia::DeviceTrackableResult::getClassType())) {
devicePoseTemp = result->getPose();
mDevicePoseMatrix = SampleApplicationUtils::Matrix44FTranspose(SampleApplicationUtils::Matrix44FInverse(modelViewMatrix));
mIsDeviceResultAvailable = YES;
}
mIsAnchorResultAvailable = [groundPlane performHitTestWithNormalizedTouchPointX:.5f andNormalizedTouchPointY:.5f withDeviceHeightInMeters:DEFAULT_HEIGHT_ABOVE_GROUND toCreateAnchor:NO andStateToUse:state setReticlePose:mReticlePose];
VuforiaEAGLViewUtils::translatePoseMatrix(0.0f, 0.0f, _objectScale, &mReticlePose.data[0]);
VuforiaEAGLViewUtils::scalePoseMatrix(_objectScale, _objectScale, _objectScale, &mReticlePose.data[0]);
if (mIsDeviceResultAvailable && mIsAnchorResultAvailable) {
Vuforia::Matrix44F poseMatrix = SampleApplicationUtils::Matrix44FIdentity();
SampleApplicationUtils::multiplyMatrix(mDevicePoseMatrix, mReticlePose, poseMatrix);
[self setCameraMatrix:poseMatrix]; // SCNCamera
}
[SCNTransaction flush];
CFAbsoluteTime currentTime = CFAbsoluteTimeGetCurrent() - _startTime;
[_renderer renderAtTime: currentTime]; // render using SCNRenderer
VuforiaEAGLViewUtils::checkGlError("EAGLView renderFrameVuforia");
How to integrate with ground plane iOS sample ? Here are the questions. I can get modelview matrix from anchor results, and need to set transform and projection into 3d model at Scenekit. Also I can get device pose from device tracker, want to set position of reticle ground plane (SCNPlane component). However, the sample from you, there is only one SCNCamera can be setup from one modelview matrix. So the question is how can I utilize the modelview matrix from multiple anchors and device pose, to show the right informations into Scenekit.