mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 18:29:11 +00:00
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:
co-authored by
A Thousand Ships
Raul Santos
parent
6b1bd26c12
commit
e09439a4e0
@@ -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
|
||||
|
||||
@@ -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
|
||||
--------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user