I want to get the absolute position of an object and move it using that absolute position. Let me explain my method. First, I use GetTransform().Translation
to get the position and then adjust the Position
with Vector3
. After that, I use the MoveTo
function with Spawn
. However, with this method, it doesn’t seem to move using the absolute position. As a countermeasure, I also changed the position setting in Verse from relative to world, but the issue was not resolved. I’d appreciate any advice.
Hi @renzymode
I’m curious as to the syntax you’ve written so that we can further assist you but here’s what I think.
The MoveTo(position, rotation, duration)
function expects the destination position in world coordinates, not relative.
@editable
var PropToMove : creative_prop = creative_prop{}
OnBegin<override>()<suspends> : void =
# Get absolute world position of the prop
CurrentTransform := PropToMove.GetTransform()
CurrentPosition := CurrentTransform.Translation
CurrentRotation := CurrentTransform.Rotation
# Create new absolute position (move 100 units up)
NewPosition := vector3{
X := CurrentPosition.X,
Y := CurrentPosition.Y,
Z := CurrentPosition.Z + 100.0
}
# Use MoveTo with absolute world position
PropToMove.MoveTo(NewPosition, CurrentRotation, 2.0)
Let me know if you have any other questions or if this doesn’t solve your issue
1 Like
I wanted to get the player’s position and move an object around that area. I’d like to try again using your code as a reference. Right now, code suggestions in VSCode are not showing up, so I’ll challenge it again after I solve the VSCode issue. Thank you so much!!
1 Like