How can I move an object in its local object space?

Evelyn MccallEvelyn Mccall Posts: 13
edited September 2020 in Daz SDK Developer Discussion

Hi.

How can I move an Object that has no parent forward in facing direction?
When I try to use setLocalPos(x, y, z+1) it moves in global space, but not in the direction it is facing to. When my object is a child of a node, then it works just fine.

Post edited by Evelyn Mccall on

Comments

  • You can change the axis system in Tool Settings, but how much that will gain you does depend on how the mdoel itself is oriented at zero. You can use the Joint Editor to edit the centrepoint parameters.

  • WendyLuvsCatzWendyLuvsCatz Posts: 31,450
    edited September 2020

    if it is a prop another way I use lately is under edit tab 

    convert prop to figure 

    move the hip bone to get it to the point you want the pivot to be (usually the centre of the grid)

    click the little bowtie shaped rigging tool (or select it in tool settings)

    rightclick in scene with hip still selected and pick edit bake joint rotations 

    then under edit tab convert figure to prop

    sounds complicated but it's actually very easy 

    Post edited by WendyLuvsCatz on
  • Evelyn MccallEvelyn Mccall Posts: 13
    edited September 2020

    Thanks guys. I am trying to get this working in my plugin.

    @Richard Haseltine That is exacly what I want to do in code. Changing the axis system.

    I'm afraid I have to use Matrices to translate the position along an axis. I was hoping for an easier solution.

     

    Post edited by Evelyn Mccall on
  • But right now I have no idea how to calulate this.

    The problem sounds so easy: Just move an object like 1cm in the direction it is facing.

  • Evelyn MccallEvelyn Mccall Posts: 13
    edited September 2020

    Acually, it was pretty easy.

    I just had to add an offset vector like this:

    
    DzVec3 Offset;
    MyObject->getWSRot().getZAxis(Offset);
    Offset.normalize();
    Offset *= 100;
    
    DzVec3 NewPosition = MyObject->WSPos() + Offset;
    MyObject->setWSPos(NewPosition);

     

    Post edited by Evelyn Mccall on
Sign In or Register to comment.