Skip to content

Configuration to control if model is centered at root origin or bounding box origin #417

Closed

Description

@cdata

Currently, we stage a model by determining its bounding box, and centering it in the viewport based on its bounding box's origin. This behavior is a reasonable default for a lot of scenarios.

Sometimes it is desirable to center a model at the origin of the root node of its scene graph. We should add a configuration that allows the user to specify this centering strategy.

This is semi-related to #271, where @jsantell mentions that this configuration might be desirable in the AR placement context.

Activity

  1. jsantell commented on Mar 6, 2019

    @jsantell
    Contributor

    Sometimes it is desirable to center a model at the origin of the root node of its scene graph. We should add a configuration that allows the user to specify this centering strategy.

    I'd expect this new flag to put the model's origin at the bottom center of the stage; "centering" seems like a misleading description in this case (IIUC).

    This is semi-related to #271, where @jsantell mentions that this configuration might be desirable in the AR placement context.

    This issue (again, IIUC) describes the current AR implementation: using the model's origin. Would this attribute be necessary to not change the AR behavior? Without this attribute, would AR models use their bounding box as the floor?

  2. cdata commented on Mar 7, 2019

    @cdata
    ContributorAuthor

    I'd expect this new flag to put the model's origin at the bottom center of the stage; "centering" seems like a misleading description in this case (IIUC).

    This configuration could very well be some combination of the anchor and origin (working title for both) style properties as we have previously discussed them.

    For context, I'm going to share our previously discussed definitions of anchor and origin here:

    Style property Values Default Definition
    anchor top bottom left right front back center center Changes how the model is positioned relative to its logical parent
    origin bounding-box natural bounding-box Changes the point that is considered the effective origin of the model
  3. cdata commented on Mar 7, 2019

    @cdata
    ContributorAuthor

    Would this attribute be necessary to not change the AR behavior? Without this attribute, would AR models use their bounding box as the floor?

    I think the conservative answer here is that how a model is positioned in AR and framed inline should be determined by two distinct sets of configurations, and that configurations or defaults for one do not affect the configurations or defaults for the other.

  4. self-assigned this
    on Mar 17, 2019
  5. cdata commented on Mar 18, 2019

    @cdata
    ContributorAuthor

    As I'm beginning to embark on this work, it seems as though the addition of this API will be sufficient to describe user intention while remaining somewhat forward-compatible with other potential framing and controls configurations:

    Attribute Values Default Definition
    align-model center natural center Changes how the model is aligned when being framed. Natural alignment maintains the model's original position (after scaling) along the given axis. Supports one-, two- or three-value syntax, corresponding to xyz, x y and x y z axis configurations respectively (similar to how transform-origin works).

    The attribute name and the word natural could probably use some bike-shedding.

  6. cdata commented on Mar 18, 2019

    @cdata
    ContributorAuthor

    Some potential alternatives to natural:

    • absolute
    • default

    Potential alternative to center is bounding-box

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arc: customizationtype: feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions