Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Plays and looks good! The only thing that bothers me is that I'm not actually dragging the piece, it feels more like force applied towards mouse pointer. Otherwise - a nice idea!

That's exactly how I'm moving them haha. I couldn't figure out any other way to do it while still maintaining the physics and collision.

Oh, I got it. Do you use constant force or it depends on distance?

Actually looking back, what I'm doing is multiplying the normalized difference between the mouse position and the plug position by a constant and setting that to the plugs linear velocity in _physics_process. I honestly just messed around with a bunch of random approaches until I found a compromise between least buggy and sorta functional. I found it pretty hard to get the rigid bodies to behave correctly, it was a lot of trial and error.

I know it's hard with physics. Have you tried setting the dragged body to kinematic mode temporary? Just an idea from the top of my head

(1 edit)

Yep I did try that, but I'm a bit confused about how that's supposed to work in code because it's not like changing the body mode all of the sudden gives you access to the normal kinematic body methods like move_and_slide...  There's definitely a better solution then what I landed on, who knows if I'll ever get to implementing it though haha.

You don't neew move_and_slide, it's fine to adjust position directly (as you don't have much colliders around) to the mouse pointer position. Just saying

(+1)

I appreciate the back and forth, maybe I'll have to release a directors cut :D