I am using a camera position to move the camera to look at combatants. It appears that the defined position is scaled by the target object's scale.

See attached:

image

I am not sure if this is by design, but if so is there some way to work around it?
  • OK so I see what is happening here... I am using Local Space in order to use the same position regardless of rotation.

    However in CameraPosition.Use() it moves the position as follows:


    if(this.localSpace)
    {
    camera.position = target.TransformPoint(this.position);
    }
    else
    {
    camera.position = target.position + this.position;
    }


    And the unity manual states:
    Note that the returned position is affected by scale. Use Transform.TransformDirection if you are dealing with direction vectors.
    https://docs.unity3d.com/ScriptReference/Transform.TransformPoint.html

    So using local space it is working as designed. The issue is that if I am not using local space I don't know how to use the relative rotation of the target. For example I want to have the camera 10 units behind the target, but since the z axis is absolute in this case I cant just say z=-10.

    I assume there's likely an easy way to do what I want here :)
  • Yes, using local space will also use the scale of the target. I'll look into adding an option to ignore the scale :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Ok thanks! That would be outstanding
  • Sry for the double reply here, would it be possible, as you are fixing that, to add more anchor options as well? Instead of just having center anchor, could we have a top anchor too? That would help to adjust for different sizes of targets without having to use branch logic.
  • That's what the Taget Child setting is there for, it allows you to use a child object of the target instead of the target. E.g. adding empty game objects for 'Head' or other parts you want to focus on.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Oh Geez, thats smart :) Glad i asked instead of trying to implement something complicated and silly..
  • Totally worked, also solved for the scale using a target object with inverse scale...
  • The next update will add an option to ignore the scale in local space :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.