parenting camera to character

I have a couple of questions about a camera that has a character set as its parent.

My first issue is that I can't seem to scale my character without affecting the camera. If I set my character's scale to 0.5, it still appears the same size on the screen and the camera appears zoomed in. Likewise if I set its scale to 2, the camera is zoomed out so the character appears still the same size. I'd like to be able to adjust the character's size relative to the other things in the world, but can't seem to do it with the parent arrangement. I tried IgnoreFromParent = Scale on the camera, but it had no affect.

The second issue relates to rotation. I've set the camera to IgnoreFromParent = rotation and this works as expected so that when my character gets rotated for some reason, the camera remains upright, which is what I want. This works as long as the camera's position is set to 0 on the x and y axis relative to the character. But, I'd like to offset the camera by -100 in the y direction so that my character is not in the dead center of the screen, but plays closer to the bottom of the screen. (I should use some fraction of the actual screen height instead of -100). But, the issue is that with the offset, if my character rotates, it now has an effect on the camera such that the camera seems to move right or left horizontally. It doesn't rotate the camera, but the horizontal motion is not desirable. It sort of makes sense that the offset causes this, but I'm hoping there may be a way to eliminate it. I so far haven't found an option that helps with this one so for now my character is center screen. If there is no option with the parent scenario, perhaps I just have to use a timer and set the camera location myself?

thanks again for any help you can offer!


  • edited December 2019

    Mmh, it's weird that ignoring the parent scale wasn't working properly to not modify the camera's zoom. I'll have to investigate on my side.

    Regarding the rotation, don't forget it's also a component that affects a child's position, and so do the parent's position and scale as well.
    So basically, assuming that ignoring scale wouldn't affect the camera's zoom, what you want is only a follow, ie. ignore everything but the parent's position, which should have been expressed this way:

    IgnoreFromParent = rotation scale position.rotation position.scale

    I'll let you know what I can find regarding the scale issue.

  • edited December 2019

    I did a quick test on my side and I'm not able to reproduce the scale issue: when setting it in the IgnoreFromParent property, my camera zoom remains unaffected by the changes of scale of the parenting object.
    Would you happen to have a minimal setup that suffers from this incorrect behavior, so that I could have a closer look?

  • Ah, it looks like that cleared up both problems! One thing I was doing wrong is when I tried to add multiple items in the ignore list, I was separating them with "#" symbols like we do in some of the other lists. It does appear that both scale and position.scale have to be in the list for the scaling of the character to work like I expect. Also, having both rotation and position.rotation indeed fixed the horizontal motion I was getting. Thanks very much!

  • Ah yes, if you use a list for any config property that doesn't end in List, only a single, randomly picked, item will be used for that property.

    As for position.scale, if it's not there, the child's position will be scaled accordingly to the parent's scale, ie. its offset won't remain constant. I'm glad it's now working for you!

  • Good to know about the # syntax... that is easy enough to remember now that I know. Thanks!

  • edited December 2019

    My pleasure! I think I might have to reword the small explanation at the top of CreationTemplate.ini/SettingsTemplate.ini:

    ; You can specify lists of values using the separator #.
    ; The default behavior will be to select randomly a value from a list *EXCEPT* if a list item index is provided in the code.
    ; For all properties defined in this template, values will be taken randomly if a list is provided for any field that doesn't explicitly accept one.
    ; Lists can contain random values.
    ; Example:
    ; Key1 = Var1 # Var2 # RandVar3 ~ RandVar4 # Var5;
    ; Lists can span multiple lines when using # at the end of the line (line ending comments are allowed).
    ; If you want to define an empty element at the end of a list, use ##
    ; Example:
    ; Key2 = Var1 # Var2 #
    ;        Var3 #; This list still continues on next line and this comment is valid.
    ;        Var4  ; This list is now complete and contains 4 elements.
    ; Key3 = Var1 # Var2 ##; This list will not span on the next line but will contain a 3rd (and last) empty element.

    By the way, the whole config syntax in a nutshell is exposed at the top of those files, in case you haven't seen it before.

  • Very helpful again, thanks. I hadn't looked much at those template files.

Sign In or Register to comment.