This is my actual set up, and for the moment I'm using this tutorial : https://www.youtube.com/watch?v=Mek4XtMhcMs&t=4s

which is one of a kind, never found any other guide on how to make 3D melee combat in godot without using some kind of rays which are useless...outside of a shooter game.... especially when your character is using a 1.8meters long greatsword.

BUT this method is very tedious, the tutorials have me add all the impact collision logic inside animations and for this to work, animations must be imported separately, which means that every time I notice something wrong with an animation and have to repair it in blender, or every time I need to add a new animation.... everything is gone and I have to re add all the collisions again.

which can be ok if you have 1 character with 1 combat ability... but when you have multiple characters with multiple combat abilities...it just gets depressing.

That's why I need something simpler, something that doesn't use the animation player, something that just a piece of code I can go and apply to every time and edit it a little bit.

enter image description here

  • \$\begingroup\$ Why do you think rays are useless outside of a shooter? If you cast a ray the length of your sword from the origin of your hand rotation, you could detect by code if it hit something regardless of your animation. This would as well allow you to have shorter/ longer weapons. But you didn't wrote anything how you want your combat system to work. \$\endgroup\$
    – Zibelas
    Commented Jun 19, 2023 at 13:41
  • \$\begingroup\$ @Zibelas. AOE like in Tera, vindictus, continent of the ninth, monster hunter, metin 2 and so on....your character has a crosshair, you point the crosshair and deal damage in a tridimensional direction...up down, left right....an area of effect. A raycast is just one point of contact, I need an area of effect not a point of effect. \$\endgroup\$
    – Cei
    Commented Jun 19, 2023 at 14:16
  • 2
    \$\begingroup\$ A raycast can give you more than one point of contact and what prevents you to fire a raycast as often as needed? (While the swing animation is ongoing) \$\endgroup\$
    – Zibelas
    Commented Jun 19, 2023 at 14:36
  • \$\begingroup\$ Even in the area of effect example, you probably want an Area to detect objects within bounds, and then do raycasts to check for line of sight (i.e. if they are not behind cover). - By the way, doing raycasts with PhysicsDirectSpaceState (with intersect_ray) is more efficient than using RayCast in particular if you need to do a lot in a single frame. \$\endgroup\$
    – Theraot
    Commented Jun 19, 2023 at 14:41

1 Answer 1


One of the "tricks" I mentioned in another answer was using an AnimationPlayer to play animation from another AnimationPlayer using an "Animation Playback Track". Doing that the imported AnimationPlayer can be untouched in Godot (and thus you do not lose work if you have to import it again), and the other AnimationPlayer can have additional tracks such as "Call Method Track" to enable/disable colliders.

Or you could split the animations, so you have Windup (a.k.a anticipation), Strike, and Recovery. Then instead of enabling/disabling colliders, when there is a collision you can check which is the current animation. Which you could queue in the AnimationPlayer, or chain with an AnimationTree. I suggested a similar approach in yet another answer.

OK, let us say you don't want to split the animation either... Then what? You could check the current position within the animation by reading current_animation_position of the AnimatinPlayer. I'd expect a small timing error given that the animation usually runs on graphic frames and physics on physic frames, but it should not be a big issue. You would have to code the time intervals for each animation, so you can compensate for any timing problem there.

Or you could take control of the playback by setting the playback_process_mode to "manual" (ANIMATION_PROCESS_MANUAL) then using seek and advance, in which case you are in control of the animation timing and there would be no timing error.

Addendum You might do the attack animations in Godot. I'm aware that Godot 3 does not let you manipulate bones directly (as Godot 4 does), but Godot 3 has an IK solution (SkeletonIK) and you can key frame the target of the SkeletonIK in an Animationplayer, so you don't need to do round trips to Blender. It is even possible to do it all programmatically, even skipping SkeletonIK, but that is more work.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .