Hello,
I need some help on what exactly orthogontal means. This camera code says:
How can I visualize this? :o
Hello,
I need some help on what exactly orthogontal means. This camera code says:
How can I visualize this? :o
orthogonal means there is a 90° angle between them.
So if you are looking forward, then straight up down would be orthogonal but also your arms straight out direction to both sides. (generally the whole plane within which your body is residing if you are standing normal cause in 3D, there is always a whole plane thats orthogonal to a single vector)
Thanks alot.
For me, an orthogonal view is one in which a 3D object is represented in 2D, flat like there’s no perspective.
Normally I see that referred to as orthographic. It’s definitely common usage to use orthogonal in that context as well; however, it tends to confuse the line between an “orthogonal camera” and an “orthogonal vector.”
So I tend to use orthographic for cameras/viewports and orthogonal for vectors/mathematical statements.
In the context of “// Always orthogonal to the forward vector” it definitely suggests an orthogonal vector - which means it is perpendicular to the forward vector.
Hey I have trouble seeing what this code does…it comes from the stock Unity 3rd person controller. _target is the position of the model right? I don’t see the point of subtracting the position of that from the characterController center. And why is it then set to the head offset? :shock:
centerOffset = characterController.bounds.center - _target.position;
headOffset = centerOffset;
headOffset.y = characterController.bounds.max.y - _target.position.y;
bit more of the code here:
var cameraTransform : Transform;
private var _target : Transform;
// The distance in the x-z plane to the target
var distance = 7.0;
// the height we want the camera to be above the target
var height = 3.0;
var angularSmoothLag = 0.3;
var angularMaxSpeed = 15.0;
var heightSmoothLag = 0.3;
var snapSmoothLag = 0.2;
var snapMaxSpeed = 720.0;
var clampHeadPositionScreenSpace = 0.75;
var lockCameraTimeout = 0.2;
private var headOffset = Vector3.zero;
private var centerOffset = Vector3.zero;
private var heightVelocity = 0.0;
private var angleVelocity = 0.0;
private var snap = false;
private var controller : ThirdPersonController;
private var targetHeight = 100000.0;
function Awake ()
{
if(!cameraTransform Camera.main)
cameraTransform = Camera.main.transform;
if(!cameraTransform) {
Debug.Log("Please assign a camera to the ThirdPersonCamera script.");
enabled = false;
}
_target = transform;
if (_target)
{
controller = _target.GetComponent(ThirdPersonController);
}
if (controller)
{
var characterController : CharacterController = _target.collider;
centerOffset = characterController.bounds.center - _target.position;
headOffset = centerOffset;
headOffset.y = characterController.bounds.max.y - _target.position.y;
}