How to declare a Vector3 and set its values?

I need to only change the Z position of a transform (by adding or subtracting from it by X value), so I came up with this code:

PropTransform := Slot.BuyButtonDisplay.GetTransform()
var XPos : float =  PropTransform.Translation.X
var YPos : float =  PropTransform.Translation.Y
var ZPos : float = PropTransform.Translation.Z
set ZPos += -10000f64

Now I’m not sure how I can turn this into an Vector3 and use it in a Prop.TeleportTo() method…

How can I accomplish something like NewVector3(Xpos,YPos,Zpos)), so I can use this vector3 in TeleportTo()?

After some extra research and studing Verse.digest, I found this:

var NewVector : vector3 = vector3{Forward:=XPos,Right:=YPos,Up:=ZPos}

Turns out I was trying to create vectors be typing “X”, “Y” and “Z” instead of “Forward”, “Right” and “Up”.

Still, this produces the error:

vector3 is experimental, and its use will prevent you from publishing your project.

If someone can confirm this is indeed a thing, and maybe have a workaround they can share, I would really appreciate it

Here’s an example of what I do, hope it helps.

var aPointA : vector3 = vector3{ X := 52178.0, Y := 6354.0, Z := 1836.0 + 74.0}

Hello Venty,

The “Forward, Right, Up” paradigm just dropped last week with the 34.00 update.

It came with good documentation about which modules to use and how to convert between the types.

Scene Graph release is probably imminent, so it should not be experimental for too much longer.

1 Like

I have tried doing this in several ways as shown below but I keep getting this error. How is it not recognizing these as vector3? I am including /UnrealEngine.com/Temporary/SpatialMath

A rotation is not a “vector3”, it’s a “rotation”. You can set a rotation with functions such as

MakeRotationFromYawPitchRollDegrees(180.0, 0.0, 0.0)
1 Like

THANK YOU. I feel very stupid now but I’m super stoked the issue is fixed! You saved me prob several more hours of googling in circles.

Ya, I had assumed it was a vector3 initially too. :slight_smile:

1 Like