如何求垂直向量

已知向量 let a :cc.Vec2

如何获得它的垂直向量

1赞

Vector2.Perpendicular

返回垂直于该 2D 向量的 2D 向量。对于正 Y 轴向上的 2D 坐标系来说,结果始终沿逆时针方向旋转 90 度。

https://docs.unity3d.com/cn/current/ScriptReference/Vector2.Perpendicular.html

我是否可以认为是 new Vec2(-a.y,a.x)

let b:cc.Vec2 = v2(x, y);
xx+yy = 1;
a*b = 0;
求出x,y

const a: cc.Vec2 = cc.v2(0, 1);
const b: cc.Vec2 = a.rotate(Math.PI / 180 * 90);
1赞

谢谢大佬的答案