How to make it possible to grab carry throw objects?

Godot Version

4.2.1

Question

Greetings, I would like to make it possible to pick up objects, drag it and throw it. I 've tried different options but it doesn 't work . Maybe someone knows how to do it right. I tried to do something like in this video, but it still doesn’t work for me.

Thanks in advance for your concern

Besides it using Godot 3, the video walks you through it quite well.
Could you proivde more details which parts give you trouble?

For starters, do you manage to get a raycast detection/interaction to work?

But you think that this video is completely suitable for the current version and I’m doing something wrong and I should do more research.

If you’re talking about print, then I generally don’t understand how it works. In some videos, they use it for verification, but when I use it, for some reason it is not displayed in my debug. I can throw off the current code that is there now, there are no lines to grab, but I can recreate them again for the purity of the experiment.
[/quote]

I’m sorry if I don’t understand it very well, I’ve only been using the engine for a week and studying it.

But you think that this video is completely suitable for the current version and I’m doing something wrong and I should do more research.

I can’t say what is the problem without knowing/seeing what exactly you’re having issues with. Hence my question about if you get the raycast interaction to work, as that would be a good starting point.

In the video that would be around the 5min mark, when the debug log prints “colliding with a rigidbody”

there is no message about interaction with the collider. I do not know if I can show a screenshot of the Code or the code itself, I do not know

  • I’ve done everything. I understand that I wrote parts of the functions in the wrong places of the script. However, there is still a problem with throwing the object, it flies in an arc and I want it to be in front . the throw code looks like this
    if Input.is_action_pressed(“kidat”):
    if picked_object != null:
    var knockback = picked_object.global_position - global_position
    picked_object.apply_central_impulse(knockback * 5)
    remove_object()

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.