TLDR;
While swinging with this code, collisions behave strangely. I want it to just hit the wall and stop without vibrating through it or getting completely stuck.
Howdy!
Using: CharacterBody2D & StaticBody2D
I'm working on some prototypes for metroidvania abilities. I've decided to make a grappling hook/rope swing mechanic.
I've managed to get a swinging motion using some basic angular physics, but I've run into an issue.
Calculating tangential velocities and applying them like a normal linear velocity will cause a slow increase in the movement arc's radius. I don't want to go into too much detail, but this is because the equations we use assume constant motion, but Godot only applies motion every frame- meaning that the arc cannot be smooth.
To remedy this, I calculate the position that the pendulum should be on each frame and apply that position directly. Unfortunately, this means that I'm not able to use the built in collisions for Godot.
I've attempted setting the velocity to 0 during collision and moving the pendulum until it no longer collides, but this causes fidgety and glitch movement. Any ideas or solutions are appreciated.
Code Below!