Initial cube position


Hi guys,

After SDK updating structure sensor “cube” has a gravity mode. It’s possible change to implement previous solution that we’ve used (static cube on fixed distance from the camera)?
On the forums I found only one topic without example how to solve the issue (

Please advise,


I tired tweaking it with no luck, I did offset the gravity value to make the sensor think it was at a steeper angle and that that worked, but then my resulting model was not perpendicular to the ground plane. I also tried manually setting the position of the groundcube to no avail.

when setting up the camera position tracking when SLAM is being setup, there is an option to change the STCameraPoseInitializerStrategy, and there is this note:

/** Aligns the camera orientation using the gravity vector, leaving the translation component to (0,0,0).
    __Note:__ This strategy does not require depth information.

Not sure how to set the “translation component” but I assume that is what would need to be tweaked.


I’ve been trying to achieve a volume at a user-specificable distance without much luck.

My first issue is that I do not understand how to position the box in space properly. I am still using the pose initializer and cube renderer to preview my volume but I currently ignore [STCameraPoseInitializer hasValidPose].

I can put the cube at a reasonable distance from the device using [STCameraPoseInitializer cameraPose] and GLKMatrix4Translate(cameraPose, 0, 0, -1) but I am unable to control it’s exact position.

I would like it so the closest face of the cube is a fixed distance from the camera. The Z offset should be something like (fixed distance) + (volume size / 2).

My second issue is that STCameraPoseInitializerStrategyGravityAlignedAtVolumeCenter still invokes some silly alignment code that snaps to surfaces instead of always using the gravity vector. For example, when in a near-vertical orientation, the volume box appears to ignore any minor gravity deviations and stays firmly vertical until sufficient rotation is present.


Say I have 2 settings: volume_cm and distance_cm and use STCameraPoseInitializerStrategyGravityAlignedAtVolumeCenter.

When I use these settings, it appears like the closest volume face is right against the camera lens as expected.

volume_cm = 200
distance_cm = 100
GLKMatrix4Translate(cameraPose, 0, 0, self.distance_cm / -100.0);


nearest face

The same feels true for:

volume_cm = 100
distance_cm = 50

But if I want to keep the closest face at a fixed distance, eg:

GLKMatrix4Translate(cameraPose, 0, 0, (self.distance_cm + C * self.volume_cm) / -100.0);
// where C must be something like ±1, ±0.5

If I set the distance_cm at 100 cm, walk up to wall, such that just the closest face of cube is visible through the surface, then change the size of the volume box dynamically, I can’t keep the face fixed to the surface, so I must be doing something wrong.


@raffy Got any luck on how to have a fixed box throughout the entire application cycle?


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