Take the location X,Y,Z of an object and add plus 30 to the X. Then using TeleportTo, to that location.
![]()
Hi Kelan,
Try implementing the system in this community video. It uses MoveTo(), but I think knowledge would be transferrable for TeleportTo(). Hope that helps.
In order to get the location of an object you can use
MyPosition:vector3= GetTransform().Translation
To add to a vector there are a few options.
You can always add two vectors together
V1:vector3= vector3{X:=0.0, Y:=0.0, Z:=0.0}
V3:= V1 + vector3{X:=30.0, Y:=0.0, Z:=0.0}
now V3 is V1 plus 30 in X.
And if you wanted to make a helper function to do this lots you could do
(V:vector3).AddX(XOffset:float):vector3=
return vector3{X:=V.X+XOffset, Y:=V.Y, Z:=V.Z}
VectorAdditionTest():void=
V1:vector3= vector3{X:=0.0, Y:=0.0, Z:=0.0}
V2 := V1.AddX(30.0)
Which takes the components of the original vector and adds the offset passed in to the X component.
You can then roughly use something like this to teleport the obj, wit the same rotation it currently has (where Pos is a vector3)
if (PropObject.TeleportTo[Pos, GetTransform().Rotation]):
Print("Teleported to:{Pos}")
2 Likes