09-06-2024, 04:48 PM
Hello,
I have the following setup.
Box with splineController that moves along 2 points in ping pong.
A script with which i get the velocity of the box with the bellow snip.
currentVelocity = (transform.position - previousPosition) / Time.deltaTime;
previousPosition = transform.position;
Then I add this velocity on my rigidbody after the i have set the its own movement velocity.
This works ok, until we are very near the next point, at which case, the rigidbody is pushed and displaced slightly.
I had the exact issue with using a custom rigidbody moving platform, but i resolved it by setting the execution order of the moving platform script to be lower than the players rigidbody.
I have tried all possible combinations, or at least most of them in terms of: getting the velocity in fixed update,update or late update, have the Target Component on Spline controller in rb and transform, locked rotations, etc.
I suspect is there is a component that runs the movement of the spline which runs after my players.
Or, that the controller snaps to end position when close enough.
Any ideas or guidance is appreciated.
Thank you in advance,
Kokoriko49
I have the following setup.
Box with splineController that moves along 2 points in ping pong.
A script with which i get the velocity of the box with the bellow snip.
currentVelocity = (transform.position - previousPosition) / Time.deltaTime;
previousPosition = transform.position;
Then I add this velocity on my rigidbody after the i have set the its own movement velocity.
This works ok, until we are very near the next point, at which case, the rigidbody is pushed and displaced slightly.
I had the exact issue with using a custom rigidbody moving platform, but i resolved it by setting the execution order of the moving platform script to be lower than the players rigidbody.
I have tried all possible combinations, or at least most of them in terms of: getting the velocity in fixed update,update or late update, have the Target Component on Spline controller in rb and transform, locked rotations, etc.
I suspect is there is a component that runs the movement of the spline which runs after my players.
Or, that the controller snaps to end position when close enough.
Any ideas or guidance is appreciated.
Thank you in advance,
Kokoriko49

