Is there a RayCast like node for a projectile motion?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AFE-GmdG

Before I try to implement a “ThrowCast” Node myself, is there something like this already inside of Godot?

I want to calculate the collision of a “stone throw” similar to the calculation of the collision by a ray cast. The math of such a collision calculation isn’t to complicated but I want to avoid implement something if it already exists.

Greetings

Nope, it will be a great idea!

Mrpaolosarino | 2021-07-06 07:00

There is the test_move function of KinematicBody, but I’m not sure if that’s what you’re looking for. https://docs.godotengine.org/en/stable/classes/class_kinematicbody2d.html#class-kinematicbody2d-method-test-move

exuin | 2021-07-06 14:14

I’ve coded a 2d Version of the “ThrowCast2D” Node already and am currently porting the Logic to 3D as well. I think I could make a Simple Addon which provides these Nodes including a SampleScene to show how to use them.
But at least I have to learn, how to create a Addon and add it to the asset store…

enter image description here

AFE-GmdG | 2021-07-08 15:08

I created the Addon (a C# Version and a GD Version)

  • the C# Version is well tested
  • the GD Version is backported from the C# Version. Since I’m working most of the time with C# the GD Version may not as good as the C# Version - but at least the DemoScene works. The C# Version may be slightly faster, it uses a optimized way to update the mesh which I can’t achieve in GD

Both Addons are send to the AssetStore but are currently in the approving process.
You could get them at my github pages:
https://github.com/AFE-GmdG/ExtraNodesCS
https://github.com/AFE-GmdG/ExtraNodesGD

AFE-GmdG | 2021-07-10 13:33