test: add comprehensive ts2lua-unreal TS/Lua 5.4 test suites and upgrade to v0.2.2
This commit is contained in:
1 parent
ee2e62bb34
commit
3dd61c32a9
75 files changed
+9929
-10
No files matched your search
@@ -0,0 +1,43 @@
|
||||
local Ex08_StructAndTrace = UnLua.Class()
|
||||
function Ex08_StructAndTrace.ReceiveBeginPlay(self)
|
||||
self.Overridden.ReceiveBeginPlay(self)
|
||||
self._tmpStart = UE.FVector(0, 0, 0)
|
||||
self._tmpEnd = UE.FVector(0, 0, 0)
|
||||
self._tmpHit = UE.FHitResult()
|
||||
self._ignoreActors = UE.TArray(UE.AActor.StaticClass())
|
||||
self._ignoreActors:Add(self)
|
||||
end
|
||||
function Ex08_StructAndTrace.ComputeVectorMath(self)
|
||||
local a = UE.FVector(3, 4, 0)
|
||||
local b = UE.FVector(0, 0, 12)
|
||||
local c = a:Add(b)
|
||||
local dot = a:Dot(b)
|
||||
local dist = UE.FVector.Dist(
|
||||
UE.FVector(0, 0, 0),
|
||||
c
|
||||
)
|
||||
return c:Size(), dot, dist
|
||||
end
|
||||
function Ex08_StructAndTrace.TraceForward(self, distance)
|
||||
local origin = self:K2_GetActorLocation()
|
||||
self._tmpStart:Set(origin.X, origin.Y, origin.Z)
|
||||
self._tmpEnd:Set(origin.X + distance, origin.Y, origin.Z)
|
||||
local bHit, hit = UE.UKismetSystemLibrary.LineTraceSingle(
|
||||
self,
|
||||
self._tmpStart,
|
||||
self._tmpEnd,
|
||||
UE.ETraceTypeQuery.TraceTypeQuery1,
|
||||
false,
|
||||
self._ignoreActors,
|
||||
UE.EDrawDebugTrace.None,
|
||||
self._tmpHit,
|
||||
true
|
||||
)
|
||||
return bHit, hit.Distance, hit.ImpactPoint
|
||||
end
|
||||
function Ex08_StructAndTrace.TeleportTo(self, x, y, z)
|
||||
local target = UE.FVector(x, y, z)
|
||||
local bMoved = self:K2_SetActorLocation(target, false, self._tmpHit, true)
|
||||
return bMoved
|
||||
end
|
||||
return Ex08_StructAndTrace
|
||||
Reference in new issue
Block a user