Summary
Using the following function with a StartGlobalTransform that changes the scale does not get applied to the sweep
(Entity:entity).FindSweepHits<public>(Displacement:(/Verse.org/SpatialMath:)vector3, StartGlobalTransform:(/Verse.org/SpatialMath:)transform)<transacts>:generator(sweep_hit) = external {}
Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
Verse
Steps to Reproduce
Use the following component to test a sweep hit from the entities’ position in world down to 0.0 in the Up axis, changing the SweepScale from 1:1:1 to smaller/larger values to test scaling
using { /Fortnite.com/Devices }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /Verse.org/SpatialMath }
test_sweep_component := class<final_super>(component):
@editable
SweepScale : vector3 = vector3{Forward:=1.0, Up:=1.0, Left:=1.0}
OnSimulate<override>()<suspends>:void=
Sleep(0.5)
RunTest()
RunTest<public>():void=
EntityPos := Entity.GetGlobalTransform()
TargetPos := EntityPos.Translation * vector3{Left:=1.0, Forward:=1.0, Up:=0.0}
StartPos := transform{Translation:=TargetPos + vector3{Up := 50.0}, Rotation:=EntityPos.Translation.GetRotationToTarget(TargetPos), Scale:=SweepScale}
Direction := vector3{Up := -1.0} * (StartPos.Translation.Up - TargetPos.Up + 50.0)
Hits := for:
Hit : Entity.FindSweepHits(Direction, StartPos)
Hit.TargetComponent.Entity <> Entity
do:
Hit
if(FirstHit := Hits[0]):
Print("Found a hit!")
Entity.SetGlobalTransform(transform{Translation:=vector3{Up:=FirstHit.ContactPosition.Up, Left:=EntityPos.Translation.Left, Forward:=EntityPos.Translation.Forward}, Rotation:=EntityPos.Rotation, Scale:=SweepScale})
else. Print("Found no hits")
(Origin:(/Verse.org/SpatialMath:)vector3).GetRotationToTarget<private>(target : (/Verse.org/SpatialMath:)vector3)<transacts> : (/Verse.org/SpatialMath:)rotation =
ForwardDirection := (target - Origin).MakeUnitVector()
Rot := MakeShortestRotationBetween((/Verse.org/SpatialMath:)vector3{Left := 0.0, Forward := 1.0, Up := 0.0}, ForwardDirection)
Expected Result
The scaling SHOULD be applied to the sweep hit entity, and therefore hit objects that may not be hit with the original scale
Observed Result
The scaling does not apply at all during the sweep hit, producing unreliable results
Platform(s)
PC