Slash-The-Hordes/assets/Scripts/Services/Utils/VecUtils.ts

7 lines
232 B
TypeScript
Raw Permalink Normal View History

2022-12-23 10:36:12 +00:00
import { Vec3 } from "cc";
export function getDirection(targetPosition: Vec3, sourcePosition: Vec3): Vec3 {
const direction: Vec3 = new Vec3();
return Vec3.subtract(direction, targetPosition, sourcePosition).normalize();
}