Add missing C# code examples to documentation

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Raul Santos <raulsntos@gmail.com>
This commit is contained in:
Shawn Hardern
2024-08-27 11:14:49 +01:00
co-authored by A Thousand Ships Raul Santos
parent 6b1bd26c12
commit e09439a4e0
17 changed files with 1385 additions and 27 deletions
+7
View File
@@ -68,6 +68,13 @@ The ragdoll is now ready to use. To start the simulation and play the ragdoll an
func _ready():
physical_bones_start_simulation()
.. code-tab:: csharp
public override void _Ready()
{
PhysicalBonesStartSimulation();
}
To stop the simulation, call the ``physical_bones_stop_simulation()`` method.
.. image:: img/ragdoll_sim_stop.gif
+18
View File
@@ -171,6 +171,24 @@ with Area3D, the boolean parameter ``collide_with_areas`` must be set to ``true`
var result = space_state.intersect_ray(query)
.. code-tab:: csharp
private const int RayLength = 1000;
public override void _PhysicsProcess(double delta)
{
var spaceState = GetWorld3D().DirectSpaceState;
var cam = GetNode<Camera3D>("Camera3D");
var mousePos = GetViewport().GetMousePosition();
var origin = cam.ProjectRayOrigin(mousePos);
var end = origin + cam.ProjectRayNormal(mousePos) * RayLength;
var query = PhysicsRayQueryParameters3D.Create(origin, end);
query.CollideWithAreas = true;
var result = spaceState.IntersectRay(query);
}
Collision exceptions
--------------------