08-27-2018, 03:39 AM
I want to offer my users the ability to turn off the guided spline and walk wherever they want. So they can go off course a bit. But if they get lost, they can hit a button and I'll find the nearest CP and set a course to that CP.
I've gotten it to kindof work so far. But something really odd happens.
So my idea was that after I toggle on freewalk mode, it will remove the spline from the player's SplineController. When I toggle it back on a few things occur. It will find the nearest CP through a simple distance calc; it will InsertBefore that nearest CP with the position at the players current position; once it reaches the CP first found, it will remove the 'virtual' one I created to smooth out the path, and the original spline should look the same.
It actually works! Except, my player is FOREVER offset from the distance that he veered off course. I even set the spline controllers relative position to the same one that's generated from the new InsertBefore CP (say, 0.371293) thinking that it might help. No. It's weird that creating a CP right on top of my character, and also setting the position to that CP, would jolt my character a few feet off.
Any thoughts on this? I'm honestly surprised this happens at all... not even sure what method to play with to ensure I can reenable the spline and walk upon it as if nothing changed.
I've gotten it to kindof work so far. But something really odd happens.
So my idea was that after I toggle on freewalk mode, it will remove the spline from the player's SplineController. When I toggle it back on a few things occur. It will find the nearest CP through a simple distance calc; it will InsertBefore that nearest CP with the position at the players current position; once it reaches the CP first found, it will remove the 'virtual' one I created to smooth out the path, and the original spline should look the same.
It actually works! Except, my player is FOREVER offset from the distance that he veered off course. I even set the spline controllers relative position to the same one that's generated from the new InsertBefore CP (say, 0.371293) thinking that it might help. No. It's weird that creating a CP right on top of my character, and also setting the position to that CP, would jolt my character a few feet off.
Any thoughts on this? I'm honestly surprised this happens at all... not even sure what method to play with to ensure I can reenable the spline and walk upon it as if nothing changed.