MoveTo doesn't move the prop to the exact player location

I’m looping MoveTo() with the player positions on VFX Spawners, but what happens is that the MoveTo function doesn’t move the device directly into the player or directly at the position provided; it sort of just moves close to the player. What this ends up doing is the VFX doesn’t get put directly onto the player, but a bit further away, which is not what I want. Is there any way to move the VFX Spawner directly into the player?

Here is an example with a teleporter device of where the device ends up around the player when using MoveTo

and here’s the code

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Fortnite.com/Game }
using { /Fortnite.com/Characters }


wallhacksdevice := class(creative_device):
    @editable var heroTrigger : trigger_device = trigger_device{}
    @editable var vfxSpawner : vfx_spawner_device = vfx_spawner_device{}

    middleMan (dude : ?agent):void=
        spawn:
            vfxFollow(dude)

    vfxFollow(dude : ?agent)<suspends>:void=
        if (ValidDude := dude?, FChar := ValidDude.GetFortCharacter[]):
            vfxSpawner.Enable()
            loop:
                if(FChar.IsActive[]):
                    playerLoc := FChar.GetViewLocation()
                    playerRot := FChar.GetViewRotation()
                    vfxSpawner.MoveTo(playerLoc, playerRot, 0.1)
                else:
                    vfxSpawner.Disable()
                    break
        

    OnBegin<override>()<suspends>:void=
        heroTrigger.TriggeredEvent.Subscribe(middleMan)

Also, the VFX is custom made using Niagara. Thank you so much

1 Like

Hey, im not at my pc so cant check, but if it always move to the same position away from the player it could that the vfx spawner pivot is not center and you would need to add a offset location (pivot is the red, green, blue lines that comes when you click on a prop and try to move it). If its not that could could try to use FChar.GetTransform().Translation for the player location and FChar.GetTransform().Rotation for the rotation Instead of GetView. Hope this help.

is there a reason you’re using ViewLocation and ViewRotation over GetTransform().Translation and .Rotation?

the GetTransform().Translation will probably solve most of your issues

if you don’t like typing it you can write an extension function to make it less annoying to type something like this

(FChar:fort_character).GetTranslation():vector3=
    return FChar.GetTransform().Translation

#Same for rotation
(Fchar:fort_character).GetRotation():rotation=
    return FChar.GetTransform().Rotation

And then just do

playerLoc := FChar.GetTranslation()
playerRot := FChar.GetRotation()

Note, To add onto this i also believe there is a new-ish device called the vfx power up device that can directly attach a niagara system to a player models socket of choice.

Only downside is there’s no verse module so you’d have to play around with implementation. I usually just use triggers.

Could you write the entire code with the lines in the right order please?

Thank you all so much

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.