Hello, I am making a system to get the closest point of a spline at the player’s position but I am getting the input key and not the values between two points.
A bit confused with wording / expectations. There are 3 spline points here so there only be 3 possible outputs - the location of splines points themselves. Instead, did you mean to:
I had the same problem with this way. In fact I would like a widget that I attach to this spline to be able to move smoothly while being as close as possible to the player’s position.
In this gif you can see that when I’m close to the spline I have a smooth movement but when I’m far from the spline the widget is attached to the points
I, obviously, do not fully understand how it’s supposed to work but that’s the gist providing I understood the intent correctly.
Your spline is attached to the target, so it should be less janky than what’s in the anim above. Not exactly sure what’s the scope but perhaps this interact thing should belong to the player - so there’s only one rather than every thing in the world owning a widget + spline + logic. Consider the architectural implications before you finalise the mechanics.
Generally speaking, it’s the player who is the instigator who approaches and interacts => show the prompt => send message to the entity. However, you may be after something else, ofc - your mileage will vary.
I made this code but I still have the issue. I made a NPC with this logic and I will create chidren for each NPC. I didn’t added this system to the player because I would like my spline attached to the NPC
You can, ofc, use the widget component in world space which you already rotate. Also, no need to attach the widget to the spline. It would only make things more complicated at times.
To make it work at greater distances, in case it gets jerky, you may need to work in some interpolation.
What’s the closest point changes to rapidly here, for example. Especially noticeable when we’re parallel to the spline.
vInterpTo - this will make it less snappy and allow it to glide much more smoother along the spline. It’s used to smooth out data over time. Many variations and applications of this method exist.
While it may seem like it at first, I don’t think this is a good overall method for this. I’d just rotate the widget towards the player. You wouldn’t even need a spline. A spline would be a must if there’s a complex path shape we must follow.
edit: I must admit the accuracy of what the Find Location Close to World Location actually returns leaves a LOT to be desired. I even cranked up the Reparam Steps of the spline segment and it still acts goofy, unable to pinpoint the world loc. And adding extra points make it worse…