Config Help

I'm looking to make a foreground object for the players arms, I'm trying to position the Z axis ahead of the parent object so I've done this:

[PlayerObjectFront@PlayerObject]
AnimationSet = PlayerAnimationSetFront
Position.z = > Object.GetPosition ^, > + < (0,0,0.1), Object.SetPosition <
IgnoreFromParent = position.position.z

Any suggestions on how to get this config to work?

Comments

  • If this object has an actual parent (in the object hierarchy way, either through ChildList or SetParent), its position is expressed in the parent's frame of reference, including Z, in which case a constant negative Z value will always have it displayed in front of its parent.

    But given your question, I take it it's not actually a child object at all, is that correct?

  • Nope it is in the child list, I'm not sure why its appearing behind. I also saw some interesting behavior where if I leave out the Position on the PlayerObjectFront it appears in a different location, however even setting "Position =" fixes it and places it in line with the paret, with a blank value.

    [Player1@PlayerObject]
    ChildList = PlayerObjectFront
    Body = PlayerBody
    Scale = 2

    ;###################################
    ; Player
    [PlayerObject]
    AnimationSet = PlayerAnimationSet
    Smoothing = true
    Position = (100,-100,0)

    [PlayerBody]
    Dynamic = true
    ;PartList = HeroBodyPart
    LinearDamping = 5

    ; Animation
    [PlayerAnimationSet]
    Texture = RunGuideBack.png
    FrameSize = (55, 55, 0)
    Pivot = center
    Scale = 2
    KeyDuration = 0.1
    IdleAnim = 4
    RunAnim = 8
    PickupAnim = 12
    StartAnim = IdleAnim
    IdleAnim-> = IdleAnim # .RunAnim # PickupAnim
    PickupAnim-> = IdleAnim
    RunAnim-> = RunAnim # .IdleAnim

    [IdleAnim]
    TextureOrigin = (0,110)
    KeyDuration = 0.1

    [PickupAnim]
    TextureOrigin = (0,165)
    KeyDuration = 0.05

    [PickupAnim8]
    KeyEvent = unused # -65000

    [ThrowAnim]
    TextureOrigin = (0,55)

    [RunAnim]
    TextureOrigin = (0,0)

    ;###################################

    ;########################
    ;Player Front
    [PlayerObjectFront@PlayerObject]
    AnimationSet = PlayerAnimationSetFront
    Position.z = > Object.GetPosition ^, > + < (0,0,0.1), Object.SetPosition < ^
    IgnoreFromParent = position.position.z
    ;> + < (-1, 0, 0)

    [PlayerAnimationSetFront@PlayerAnimationSet]
    Texture = RunGuideFront.png

  • edited December 2020

    Here's a simple test I based on your config that yielded the expected result when used inside the bounce playground:

    [PlayerObject]
    Graphic = @
    Texture = pixel
    Size = (100, 100)
    Smoothing = true
    Pivot = center
    
    [Player1@PlayerObject]
    ChildList = PlayerObjectFront
    Position = (100, -100)
    Scale = 2
    Color = (255, 0, 0)
    
    [PlayerObjectFront@PlayerObject]
    Position = (0, 0, -0.01)
    Color = (0, 255, 0)
    IgnoreFromParent = scale
    

    The Important component here being the -0.01 Z value for the child's position.

    Now, on a related unrelated topic, regarding your former configuration:

    Position.z = > Object.GetPosition ^, > + < (0,0,0.1), Object.SetPosition < ^
    

    There are a few things here that can't work:

    • Position.z isn't an object key, Position is
    • If you want a config value to do a lazy command evaluation, you need to start it with %
    • As it's a config command, there are no objects around, so if you need to modify an object post-creation, you'll need to use a timeline track instead
      Let's say you want to modify the object at runtime, here's how you could do it:
    [PlayerObjectFront@PlayerObject]
    TrackList = @
    0 = > Object.GetPosition ^, > + < (0, 0, -0.01), Object.SetPosition ^ <
    

    However in this particular case, that would yield the same result as setting the constant position in the first place.

    You can check an object's hierarchy (including local/world position, rotation and scale) by running the following commands:

    > Object.FindNext PlayerObjectFront
    Object.LogParents <
    

    In this case, I got:

    EDIT: Adding a text version as apparently we can't see the full scale image in the forum:

    *** BEGIN PARENTS LOG: "PlayerObjectFront" [0x0000003A0000200F] ***
    
                 NAME                     GUID             [LOCAL]   POSITION        ROTATION           SCALE      =>    [WORLD]   POSITION        ROTATION           SCALE      [IGNORE FLAGS]
    "PlayerObjectFront"           [0x0000003A0000200F]             (0, 0, -0.01)         0               (1, 1, 1) =>       (100, -100, -0.01)         0               (1, 1, 1) [scale]
    "Player1"                     [0x000000390000030F]            (100, -100, 0)         0               (2, 2, 1) =>           (100, -100, 0)         0               (2, 2, 1) [none]
    
    *** END PARENTS LOG ***
    
  • edited December 2020

    Awesome that does fix things, I appreciate the help. Thats also a great tip for finding out the information from the console.

    I do notice its not following the same animation, which I thought children did. Would there happen to be an easy method of linking animations together?

    I did see this one:
    However I dont think it would work since I'm setting animations based on keypress.

  • My pleasure!

    Yes, one way to do it is the one described in this video: use the recursive versions of SetCurrentAnim/SetTargetAnim.

    I'm not sure I understand the constraint of the keypress though and how that prevents you from using this approach. Would you mind giving more details?

  • edited December 2020

    Unfortunately I had a hard time understanding the video because hes silent during the parts I'm trying to figure out so it flew over my head.

    I realized foolishly that there was a function orxObject_SetTargetAnimRecursive which did work, thanks again!

  • Ah I see. Don't hesitate to give us feedbacks on those video, this will help us improve over time.

    The 3rd one should already be a bit better as I'm not typing the content live anymore: I wrote a tool that automates this part entirely, which in turns makes the entire video flows better.

Sign In or Register to comment.