@hautajoki/rbxts-transformer-vector
v0.1.1
Published
A roblox-ts transformer that lowers direct Vector3 operations to vector library calls
Readme
@hautajoki/rbxts-transformer-vector
A roblox-ts transformer that lowers the direct Vector3 operations with clear Luau vector equivalents, while leaving native Vector3 APIs alone when they should stay native.
What it rewrites
new Vector3(...)->vector.create(...)Vector3.zero->vector.zeroVector3.one->vector.onev.Abs()->vector.abs(v)v.Angle(other, axis?)->vector.angle(v, other, axis?)v.Ceil()->vector.ceil(v)v.Cross(other)->vector.cross(v, other)v.Dot(other)->vector.dot(v, other)v.Floor()->vector.floor(v)v.Magnitude->vector.magnitude(v)v.Max(...)->vector.max(v, ...)v.Min(...)->vector.min(v, ...)v.Sign()->vector.sign(v)v.Unit->vector.normalize(v)
What it preserves as native Vector3
Vector3.xAxisVector3.yAxisVector3.zAxisVector3.FromAxis(axis)Vector3.FromNormalId(normal)v.Lerp(goal, alpha)v.FuzzyEq(other, epsilon?)
Usage
Install the package and add it to tsconfig.json:
{
"compilerOptions": {
"plugins": [
{
"transform": "@hautajoki/rbxts-transformer-vector"
}
]
}
}