I need help with something in verse.

So i’m searching for help.

First of all, I want too explain what i’m doing, I’m working (or trying to) make a working flashlight using a prop that is actually a Spotlight, and it works perfectly using the code I’ll show in a bit, It correctly moves to the player’s position and also follows player’s looking direction, but the only issue is that if you start looking more to the left or the right, the light will start moving very crazy (even if the player isn’t moving the mouse at all), so, basically, it works perfectly, but for some reason it moves crazy when you turn 180º (let’s say). This happens even if it’s some random static mesh, it will start moving very crazy. This is the code:

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

source_light := class(creative_device):

    @editable
    FollowerProp : creative_prop = creative_prop{}

    DoFollowPlayer()<suspends> : void =
        loop:
            if (PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[0].GetFortCharacter[]):
                PlayerPosition : vector3 = FortniteCharacter.GetTransform().Translation
                FollowerProp.MoveTo(PlayerPosition, FortniteCharacter.GetViewRotation(), 0.2)             
                
            else:
                break
            Print("Follow")
    OnBegin<override>()<suspends>:void=

        DoFollowPlayer()

Like, I said, it works very well but the only issue is the one I mentioned above, hope you can help me :slight_smile:

“Moving crazy” makes me think this might have to do with collision; (UE can go a little “crazy” when 2 objects are attached to each other and also have collision interaction)

Try opening up the mesh inside of UEFN, and select remove collisions from the collision drop down. (This also assumes you don’t have any complex collision, if you do, simply export the mesh only from whatever 3d editor, and then reimport)

1 Like

I removed the collision in every mesh I could out of the blueprint, even removed the collision inside the level. Heres a preview of what I mean (sorry about the quality), you can see it follows me correctly, the flickering is okay to me that’s due to the 0.2 delay, but as u can see at the start it works correctly and when I look to that direction, but if i move to the left or to the right a bit more it will move like that for some reason, the same code was used btw:

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

source_light := class(creative_device):

    @editable
    FollowerProp : creative_prop = creative_prop{}

    DoFollowPlayer()<suspends> : void =
        loop:
            if (PlayerList := GetPlayspace().GetPlayers(), FortniteCharacter := PlayerList[0].GetFortCharacter[]):
                PlayerPosition : vector3 = FortniteCharacter.GetTransform().Translation
                FollowerProp.MoveTo(PlayerPosition, FortniteCharacter.GetViewRotation(), 0.2)             
                
            else:
                break
            Print("Follow")
    OnBegin<override>()<suspends>:void=

        DoFollowPlayer()

1 Like