Proper physics implementation for a grappling hook.
Alright so I'm working on a small game in which the player can shoot a grappling hook towards an object they're looking at, and by doing so they should swing around said object until they let go. The player will be able to constantly accelerate and will do all of the swinging whilst in the air. I've made a small visualization in Paint to make things clearer (the drawing is 2D but the game will allow movement in 3D). link. The main thing I'm "stuck" on is the best way to approach physics in this scenario.
My first thought would be to simply change the direction of my Rigidbody Velocity in such a way that the player orbits and object. However, Unity recommends you do not change the velocity directly which kinda threw me off. After reading the documentation I'm unsure how to best get the desired result, considering I have to account for drag, gravity (this will be negligible at higher speeds), the constant increase in speed and the player's ability to modify the amount of "pull" the hook has.
Would I be perfectly fine adjusting the direction in which I apply my velocity based on where the hook is attached, player input and gravity or should I use AddForce or maybe use something different in its entirety?
Posted Jul 8, 2019, 3:46 PM UTC
They are merely trying to say the movement would look unrealistic and can mess with physics if used incorrectly, it is perfectly fine to set the velocity and if they didn't want you to do it ever then you wouldn't be able to change it's velocity directly using their own API.