Basically the title. I’m working on a top-down, 2D project where you can grab and throw RigidBody2D items, and I was hoping to apply the same sort of physics to grabbing & throwing my CharacterBody2D enemy nodes.
As a first pass, I just gave the Enemy scene a RigidBody2D child node, and passed that in for the physics when thrown by the player. I can see the linear velocity of the enemy is updated correctly, but no motion happens.
Is there a way to “disable” the root CharacterBody2D behavior of the enemy so I can treat it as a a RigidBody2D temporarily? Been struggling to find solid answers online, any drops of knowledge would be super helpful.
EDIT: I realize now the enemy doesn’t move because JUST the RigidBody collision shape is flying away, but the actual sprite/other aspects of the Scene are still stationary. Still not sure how to drag the rest of the scene along with that launched collision shape, though.
What I’m about so say may be super dumb buttt maybe you can completely delete the enemy (with the ChracterBody2D root) when it is grabbed and like spawn in the same identical thing just with a RigidBody2D root node.
You could implement grabbing & throwing with CharacterBody2D since it’s just modifying the velocity, and nothing else different, there’s no need to use a RigidBody2D.
I was hoping to find an easier solution, but I just did this and I think it’ll have to be the way.
My enemy is too reliant on the rest of the CharacterBody2D behavior at this point to totally refactor it into a RigidBody2D It’s a bit annoying to redo all the throw logic of my GrabbableComponent to try and mimic the same physics for the enemy as exists for my RigidBody2D items, but at least it’s doable. Thanks all!