meta data for this page
Basics/VectorUtils.lua
This class provides some helpful utils functions when dealing with Vector3 or other vector types.
VectorUtils.transformDirection(objectId, vector)
29 function VectorUtils.transformDirection(objectId, vector) 30 return Vector3:new(Utils.transformDirection(objectId, vector.x, vector.y, vector.z)); 31 end;
VectorUtils.inverseTransformDirection(objectId, vector)
33 function VectorUtils.inverseTransformDirection(objectId, vector) 34 return Vector3:new(Utils.inverseTransformDirection(objectId, vector.x, vector.y, vector.z)); 35 end;
VectorUtils.transformPoint(objectId, vector)
37 function VectorUtils.transformPoint(objectId, vector) 38 return Vector3:new(Utils.transformPoint(objectId, vector.x, vector.y, vector.z)); 39 end;
VectorUtils.inverseTransformPoint(objectId, vector)
41 function VectorUtils.inverseTransformPoint(objectId, vector) 42 return Vector3:new(Utils.inverseTransformPoint(objectId, vector.x, vector.y, vector.z)); 43 end;
VectorUtils.getAngle(a, b)
45 function VectorUtils.getAngle(a, b) 46 return Utils.getAngle(a.x, a.y, a.z, b.x, b.y, b.z); 47 end;
VectorUtils.getAngleSigned(a, b)
49 function VectorUtils.getAngleSigned(a, b) 50 return Utils.getAngleSigned(a.x, a.y, a.z, b.x, b.y, b.z); 51 end;
VectorUtils.lookRotation(a, b)
53 function VectorUtils.lookRotation(a, b) 54 assert(not a:isNan(), "look rotation viewing vector has a NaN value"); 55 assert(not a:isZero(), "look rotation viewing vector is zero"); 56 57 return Vector3:new(Utils.lookRotation(a.x, a.y, a.z, b.x, b.y, b.z)); 58 end;
VectorUtils.getNextPointBetweenVectors(a, b, c)
60 function VectorUtils.getNextPointBetweenVectors(a, b, c) 61 return Vector3:new(Utils.getNextPointBetweenVectors(a.x,a.y,a.z, b.x,b.y,b.z, c.x,c.y,c.z)); 62 end;
VectorUtils.projectOnVector(a, b)
64 function VectorUtils.projectOnVector(a, b) 65 return Vector3:new(Utils.projectOnVector(a.x, a.y, a.z, b.x, b.y, b.z)); 66 end;
VectorUtils.projectOnPlane(a, b)
68 function VectorUtils.projectOnPlane(a, b) 69 return Vector3:new(Utils.projectOnPlane(a.x, a.y, a.z, b.x, b.y, b.z)); 70 end;
VectorUtils.setPosition(objectId, value)
78 function VectorUtils.setPosition(objectId, value) 79 setPosition(objectId, value.x, value.y, value.z); 80 end;
VectorUtils.setWorldPosition(objectId, value)
82 function VectorUtils.setWorldPosition(objectId, value) 83 setWorldPosition(objectId, value.x, value.y, value.z); 84 end; 85
VectorUtils.setRotation(objectId, value)
87 function VectorUtils.setRotation(objectId, value) 88 setRotation(objectId, value.x, value.y, value.z); 89 end;
VectorUtils.setWorldRotation(objectId, value)
91 function VectorUtils.setWorldRotation(objectId, value) 92 setWorldRotation(objectId, value.x, value.y, value.z); 93 end;
VectorUtils.setRotationQuaternion(objectId, value)
95 function VectorUtils.setRotationQuaternion(objectId, value) 96 setRotationQuaternion(objectId, value.x, value.y, value.z, value.w); 97 end;
VectorUtils.setWorldRotationQuaternion(objectId, value)
99 function VectorUtils.setWorldRotationQuaternion(objectId, value) 100 setWorldRotationQuaternion(objectId, value.x, value.y, value.z, value.w); 101 end; 102
VectorUtils.setScale(objectId, value)
104 function VectorUtils.setScale(objectId, value) 105 setScale(objectId, value.x, value.y, value.z); 106 end; 107
VectorUtils.getPosition(objectId)
109 function VectorUtils.getPosition(objectId) 110 return Vector3:new(getPosition(objectId)); 111 end;
VectorUtils.getWorldPosition(objectId)
113 function VectorUtils.getWorldPosition(objectId) 114 return Vector3:new(getWorldPosition(objectId)); 115 end; 116
VectorUtils.getRotation(objectId)
118 function VectorUtils.getRotation(objectId) 119 return Vector3:new(getRotation(objectId)); 120 end;
VectorUtils.getWorldRotation(objectId)
122 function VectorUtils.getWorldRotation(objectId) 123 return Vector3:new(getWorldRotation(objectId)); 124 end; 125
VectorUtils.getRotationQuaternion(objectId)
127 function VectorUtils.getRotationQuaternion(objectId) 128 return Quaternion:new(getRotationQuaternion(objectId)); 129 end;
VectorUtils.getWorldRotationQuaternion(objectId)
131 function VectorUtils.getWorldRotationQuaternion(objectId) 132 return Quaternion:new(getWorldRotationQuaternion(objectId)); 133 end; 134
VectorUtils.getScale(objectId)
136 function VectorUtils.getScale(objectId) 137 return Vector3:new(getScale(objectId)); 138 end;
VectorUtils.getLossyScale(objectId)
140 function VectorUtils.getLossyScale(objectId) 141 return Vector3:new(getLossyScale(objectId)); 142 end; 143
VectorUtils.crossProduct(a, b)
145 function VectorUtils.crossProduct(a, b) 146 return Vector3:new( 147 a.y * b.z - a.z * b.y, 148 a.z * b.x - a.x * b.z, 149 a.x * b.y - a.y * b.x 150 ); 151 end; 152
VectorUtils.dotProduct(a, b)
154 function VectorUtils.dotProduct(a, b) 155 return a:dotProduct(b); 156 end; 157
VectorUtils.rotationToDirection(a)
159 function VectorUtils.rotationToDirection(a) 160 return Vector3:new(Utils.rotationToDirection(a.x, a.y, a.z)); 161 end; 162
Copyright
All contents of this page may be used for modding use for Winter Resort Simulator - Season 2 only. Any use exceeding this regulation is not permitted.
Copyright (C) HR Innoways, 2021. All Rights Reserved.