Cube Size set with predefined sizes


i have tried to comment adjustVolumeSize everywhere in my code however the size change


What we want to do


So as shown in the video, the cube remains at whatever size is selected by the user. It doesn’t change size as you change the distance from the sensor to the object. Isn’t this what you’re looking for?



what we want to do: Ensure that the distance from the scanner to the beginning of the boxe of scanning is always the same distance. Because, it cuts the edge of breast once a while.



You could try translating the final camera pose calculated by STCameraPoseInitializer in enterScanningState, e.g.:

_slamState.tracker.initialCameraPose = GLKMatrix4Translate(_slamState.cameraPoseInitializer.cameraPose, 0.0, 0.0, 0.05);

Here’s a video showing the results:


How to cancel out floor from Scanner app?

Yes we want that thing fixed box. how are you fixing that ? Where are you writing that code? We are using demo Scanner app code.

_slamState.tracker.initialCameraPose = GLKMatrix4Translate(_slamState.cameraPoseInitializer.cameraPose, 0.0, 0.0, 0.05);


@LordAlex, look in the function enterScanningState…



thanks a lot jim.
Can you give just a bit more, an example or a source somewhere? we are relative new to the code still. thanks


In look for the method called enterScanningState. Replace the line that currently initializes _slamState.tracker.initialCameraPose with the one I posted above.

0.05 meters offset may not be exactly what you need, so you may have to play with that.



Hi, @jim_selikoff
I am using your last SDK 0.6 and trying to put the box at a fixed distance from the camera as well in your Scanner App. I referred your post here to change it but it didn’t work for 0.6 when I changed the line like you wrote here(The box disappears after I press Scan and won’t scan anything) I want my cube to behave like it does with STCameraPoseInitializerStrategyTableTopCube (the box is in the middle of the screen) except I do not want the cube to constantly try to find a plane and I want it to put at a fixed distance in z-direction like for example 1 meter from the camera.
Thank you in advance.


Hi @tuna.ozerdem,

Do you want the cube aligned with gravity during placement?



Thank you for replying me back quickly @jim_selikoff. I am not sure what kind of an effect the gravity has on the cube when you do the placement unfortunately. If you could explain it briefly I may be able to answer whether I want it to align or not with gravity.


But let me put it this way, eventually I want the cube to be put at the center of the screen initially (before scanning) and let the user decide where to put the cube with their fingers and let them resize the cube with the pinch gestures. Currently, with the Scanner App, cube can be resized with pinch in-out gestures so thumbs up for that! But I think for the profile that are going to use this app, it would be easier for them to see the cube at the center initially, and let them decide where to put the cube on the screen. I hope this makes it more clear for you to understand if the cube should be aligned with the gravity vector. Thank you


When you rotate the tablet, the cube stays aligned to the gravity vector. This would occur when using any of the STCameraPoseInitializerStrategy options.



Okay, that’s fine I can have the cube to be aligned with gravity.


Refer to SDK 0.6 Fix the Cube at a certain distance from the user for a followup on fixed cube placement.


Hi Jim,

Is there a recommended way to not have the box aligned to gravity? I have the fixed cube placement outlined here SDK 0.6 Fix the Cube at a certain distance from the user, and would prefer if the bottom of the box stayed parallel to the bottom of the iPad during cube placement.




For an unaligned placement cube, you really don’t need to use the STCameraPoseInitializer at all, but here’s a quick hack that may do the trick:

In processDeviceMotion:

_lastGravity = GLKVector3Make(0.0, 0.0, 1.0);



Hi Jim,

Thanks for the point in the right direction. What ended up working is
_lastGravity = GLKVector3Make (-1.0, 0.0, 0.0);.

It appears the CMAcceleration coordinate system is x for up-down, y for left-right, and z for forwards-backwards. And then up-down is negative because acceleration is down toward the ground.



Cool, thanks for following up!