I’m currently trying to understand perspective in 2D games specifically 2D drawn perspective with two vanishing points. A general rule with two point perspective is to place the vanishing points outside of the composition to avoid distortion. The thing is the scene I’m working on has two vanish points which are inside the composition and close to each other causing a “fish eye” distortion but without curved lines so it’s a false perspective none the less my job is to write a script for movement within the scene.
My current plan is to attach two empty objects to the character one at the base of the feet for “root” location and movement and one at the top of the head to handle scaling. The bottom “root” point would move along the distorted plane using a vanishing point movement script and the top point would scale using the same vanishing point script. I originally set the camera to perspective to use z movement for perspective scaling but noticed that this wouldn’t work since the camera only has one perspective point so I am working purely in orthographic. Any help would be appreciated as to how I would script something like this.
Based on a previous forum post I’m using this script for vanishing point movement.
var inputX = Input.GetAxisRaw("Horizontal");
var inputY = Input.GetAxisRaw("Vertical");
var multiplier = Mathf.Abs(vanishingPoint.position.y - transform.position.y) / maxDistance;
speedVert = Mathf.Lerp(0.2f, 3f, multiplier);
speedHor = Mathf.Lerp(0.2f, 3f, multiplier);
var vertDir = (vanishingPoint.position - transform.position).normalized;
var moveY = inputY * speedVert * Time.deltaTime;
transform.position += vertDir * moveY;
Here’s the scene I’m working on showing vanishing points and distortion planes.