Trying to make a pinball game.
Currently just testing with a ball (RigidBody2d) and a flipper(Kinematic2d).
The flipper arc goes from -244 degrees to 60 degrees.
This is within the Physics_Process. I've set the flipper to syncing motion to physics as well as moving the ball to a higher process priority
Setting the rotation essentially clears the flipper and puts it at the new angle, with no collisions detected.
Ive tried basically a manual tween, where I set a state of swinging = true, and then on delta frames use a swing method to increment rotation by 0.18. Works, but the flipper can miss, so I tried tweening.
Tweening the sprite and collider seems better, but occasionally the flipper locks up. Though its my first time using tween, so I could be doing something weird. I tried the 1.1 multiplier, thinking if the collider moves faster that I could get the spot where I'm missing the ball.
if rotation != -rot_cap:
tween.interpolate_property(get_node("/root/Main/YSort/LFlipper"),"rotation",null, -rot_cap, tween_speed)
tween_coll.interpolate_property(get_node("/root/Main/YSort/LFlipper/Flipper/CollisionShape2D"),"rotation",null, -rot_cap, tween_speed*1.1)
Ive also tried setting up an area2d for the swing path and detecting if the ball is in it, which still may be a workaround, just need to wrap my head around all the physics behind the hit.
Also starting to think of going back to switching the Flipper to a RigidBody and messing with Torque values. Although when I tried this last I also had the issue of the ball pushing the flipper, but I think I can solve that with a linear damp?