0 votes

Hi guys,

I've read many articles and the documentation in order to get the RigidBody2D to do what i want.

How is it possible to create a magnetic field like in a breakout game?

I get my ball stuck on the paddle and I can release it, but when my ball is stuck, i can't move my paddle OR my ball doesn't move with my paddle...

""
if body.getname() == "Player" and Input.isactionpressed("debugkey"):
emitsignal("clicked", self)
mode = RigidBody2D.MODE
STATIC
held = true
if held:
globaltransform.origin = body.getnode("Anchor").getglobalposition()
if Input.isactionpressed("goball"):
held = false
mode = RigidBody2D.MODE
CHARACTER
setlinearvelocity(velocity)
""

And my ball only get centered on my paddle with:

""
globaltransform.origin = body.getnode("Anchor").getglobalposition()

""
I want my ball stuck at the Position who it enters

Thanks a lot

in Engine by (20 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories