- Home /
I am having an issue with visual distortion
Greetings all, I am having two issues, one with visual distorion and another with transform values not being properly represented in the inspector. I belive that these two issues may be related so I am putting them both into the same question. To begin with the scene is fairly simple. If it heps anyone I am working on a side scrolling fighter game like mortal combat. There is a plane, a model, some lights and a camera. The plane, lights and camera do not move. The camera is facing the side of the model viewing it as it moves along the x axis. The model is facing -x and only moves along the x axis. At one point I moved the plane so the model would walk along the edge of the plane to see it if was moving in a straight line and it is. The first issue is visual distortion of the model as the model is moving along the x axis, it appears to be larger and closer when it is on the sides of the view and smaller and farther away when it is in the center. I cannot think of a reason why this would happen because the model is only changing its x coordinates. The seccond issue is watching the transform of the mode in the inspector the z axis value is changing, even though it is not actually changing based on the test I did with the edge of the plane. If I hold down the button the z axis will go from 0 to -10 and snap back to 0 and start to go back to -10. I tried setting the value of the z axis while it was alomost -10 to -10 and the location of model moved quite far. I cannot explain this behavior, the inspector reports the position of the model moving but if I set the inspector to the values it has then it moves way off. I believe these two issues are related because if the camera thinks the model is at a different z then it would change the size. Has anyone seen this kind of issue before?
For the weird movement problem you need to post the code!
This is a composit of the distortion, it is not huge distortion but it is noticable.
What happens if you pull the camera back from the scene then change the field of view to match the above layout?
here is the code.
} else if ( Input.GetAxis( "Horizontal" ) ) {
//Debug.Log( "button 7 pressed" );
var inp:float = Input.GetAxis( "Horizontal" );
$$anonymous$$over(inp);
}
function $$anonymous$$over( inp:float ) {
var style = ["walking", "english_step", "irish_step" ];
if ( ! animation.IsPlaying(style[mode]) ) {
animation[ style[mode] ].speed = inp;
if ( inp < 0 ) animation[ style[mode] ].time = animation[style[mode]].length;
animation.CrossFade( style[mode] );
}
charCont.$$anonymous$$ove( transform.forward * Time.deltaTime * speed * inp );
}
Since the problem in the title is resolved and these issues are obviously not related, why not close this questiona and ask another specific to your other problem?
Answer by Sequence · Jun 12, 2013 at 12:00 AM
I believe you are dealing with a perspective camera. Try selecting the camera and changing the field of view. It warps more or less doesn't it? You're probably making a "2D" platformer, correct? What you probably want is an orthographic camera. Right above the field of view slider, you should see a pulldown menu. Change from perspective to orthographic. The camera is now perspective-less. You may need to change the camera's distance from your objects and the new "size" slider to get it just right and to get your objects to show at all. Hope this helps!