Is it (trivially) possible to create a 2d top-down character controller using the Rigidbody2D.Slide API?
I was rather excited when I found the Rigidbody2D.Slide API in the documentation but then was quickly disappointed when I realized it was tailored around platformer physics. Specifically, I was bummed when I realized that the Rigidbody2D.SlideMovement.surfaceUp required a non-zero-vector value. I was hoping a value of zero-vector would mean that it would slide on all axis using the surface normal.
Is there something I am missing with the configuration that would make this possible? Or will I have to essentially use the Rigidbody2D.Slide API as more of a “body cast” and implement the actual sliding myself? At that point, it would seem pointless to use the API and would be better off using the Rigidbody2D.Cast or Collider2D.Cast APIs.
That’s a good observation, allowing this to be zero (degenerate) would mean it didn’t use the angle limit. Similar to how the anchor works.
I can look at adding that for you ASAP.
If you want to submit that as a bug, citing this thread, then I can use that bug report to push it through as well as you having a mathoe to track the change. If you do that, please send me the case incident ID.
Thanks for the quick reply. Excuse my ignorance, but do you want me to report a bug through the Unity Editor Help menu? (never reported a unity bug before)
Yes please. Don’t forget to mention this post and that you were asked by an employee to submit it. This should fast-track the process when CQA get around to seeing it.
In that there’s a top-down controller example here with the basic Kinematic controller example script here which is close to what the basic “Slide” stuff does.
Note that in that old example there, a new feature hasn’t been used which is the ability to cast from a specific position so you don’t have to continually update the position of the rigidbody during interations.
Just a heads-up to say that today I’ve fixed this issue and I’ll be getting the fix out ASAP. You can use the link above to watch for your case landing in future releases.