Obj on Character Controller is strangely deforming

Hi! (I’m not quite sure if this thread is posted under the right topic)

I have the following problem. I added my flashlight.obj I created in blender to my Standard Asset Character Controller. I want it to follow the camera so it’s always in the bottom left corner. The problem is that whenever I look up or down, the flashlight gets stretched in a very strange way and I have no idea on how to fix that.

Thank you for helping me.

Can you please create an image with sunlight added, becuase its very dark

Yeah sure, sorry, didn’t think about that.2654819--187368--unitybug2.png

Does the camera that renders your flashlight have a different FOV than the main camera or something? Not sure if this would effect it, but maybe if your vertical rotation is in some way off, mismatched fields of view could cause this.

I’m not quite sure if I got that right. This would require two cameras to be there, wouldn’t it? But the whole scene only has that one camera placed on my controller. “but maybe if your vertical rotation is in some way off, mismatched fields of view could cause this.” - Do you know on how to fix that?
I added the flashlight as a child to the camera which is already moved by the controller script. I thought it would work like that.

@Einfach_Tobi

You’re correct; if you’re only using one camera, then my guess is wrong.

Are you sure nothing is rotating your flashlight independently of its parent object?

I’m also wondering if you could post of .gif of the effect. Maybe visualizing it will reveal something.

I’m not sure but I think that’s the case.

I can make a .gif but the quality is not that good, sry.
(UPDATE: Okay, it wont let me upload the file… it says “The uploaded file is too large for the server to process.” even though it isn’t! I resized it so many times and it only has a size of 2MB…
There you go: http://prntscr.com/bdj4gb )

Could you check the scene view for me? Did the one there get longer too?

Never had the idea on checking that. Yeah it did. So it’s not one of the image effects.

Have you checked the flashlight’s scale when it does that? It really looks like its scale is being changed by something.

It looks to me like it is parented to something with non-uniform scale. When the child rotates, it aligns itself with a different axis (in this case, looking up or down will align with the Y axis) and if that axis has a different scale than the others, the child will stretch to match.

You can reproduce this effect easily by creating an empty object with scale (1,2,1), adding a cube as a child of that object and rotating the cube around x or z.

2 Likes

Thank you! I think, that’s it! But I actually have no idea, how to fix that. I appreciate your help!

Yeah, the scale does change.

The fix would be to keep every object in your character’s hierarchy, down to the object that rotates, at a uniform scale (keeping things at (1,1,1) tends to be easiest, but as long as the x, y and z are the same on each object, it should work).

If you want to change the size of your character controller you should change the height or radius parameters on the character controller component itself, not scale the transform.

If there is something that you absolutely need to be non-uniform scale, then you could keep it in a separate ‘branch’ of your hierarchy to the rotating object, so it doesn’t affect it.

1 Like