MIJGames.Radius2D
1.0.1
dotnet add package MIJGames.Radius2D --version 1.0.1
NuGet\Install-Package MIJGames.Radius2D -Version 1.0.1
<PackageReference Include="MIJGames.Radius2D" Version="1.0.1" />
<PackageVersion Include="MIJGames.Radius2D" Version="1.0.1" />
<PackageReference Include="MIJGames.Radius2D" />
paket add MIJGames.Radius2D --version 1.0.1
#r "nuget: MIJGames.Radius2D, 1.0.1"
#:package MIJGames.Radius2D@1.0.1
#addin nuget:?package=MIJGames.Radius2D&version=1.0.1
#tool nuget:?package=MIJGames.Radius2D&version=1.0.1
<p align="center"> <a href="https://github.com/MIJGames/radius2D"> <img src="Images/logo.png" width="70%" alt="Radius2D Logo"> </a> </p>
Radius2d
Radius2D is an experimental Physics Engine implementation. It uses Raylib for rendering and Keyboard Input purposes. It was once written in C++, but now have been changed into C# for having better Object-Oriented approach and more sophisticated Vector Calculations. It currently is in the early-development stages. As it now have been shifted into C#, it use Raylib_cs which basically is a C# wrapper for Raylib.
How To Install
To use this, you need the .NET SDK, if you don't have you can download from here.
Clone this repo and execute dotnet run in the Radius2D/Source directory.
Examples
<p align="center"> <a href="https://github.com/MIJGames/radius2D/Examples/ClothSimulation"> <img src="Images/Cloth_Sim.png" width="49.5%" alt="Cloth Simulation"> </a> <a href="https://github.com/MIJGames/radius2D/Examples/SoftBodySimulation"> <img src="Images/SoftBody_Sim.png" width="49.5%" alt="Cloth Simulation"> </a> </p>
Cloth Simulation
This is a sample simulation of Radius2D,
This Cloth Simulation is made by having few Circles ( with radius 0 ) being placed and connected with springs. Which is why it is not a normal cloth simulation but an Elastic Cloth Simulation.
It also have Mouse inputs for Simulating Wind Effects,
- Hold Left Mouse Button for Wind to blow from Left.
- Hold Right Mouse Button for Wind to blow from Right.
Soft Body Simulation
This is also a sample simulation of Radius2D,
This simply is a Soft Body Simulation having a Circle in the center and few more Circles around that and all the circles are connected through Springs which gives it Soft Body Effect.
How to Use
After yu have added all files in /Source directory in your project (except Program.cs and Radius2d.csproj). You need to include Radius2D in your Program.cs file.
using Radius2D;
Now you need to initialize the Physics Layer
var Layer = new PhysicsLayer();
You can now add Circles, Lines and Springs in the Lists of your Physics Layer,
// Adding Circles in the Physics Layer
for (int i = 0; i < 10; i++)
{
int posX = Raylib.GetRandomValue(0, 1920);
int posY = Raylib.GetRandomValue(0, 1080);
var Circ = new Circle(posX, posY, 0, 0, 15, 20, 1.0f, Color.White);
Layer.circles.Add(Circ);
}
// Adding Lines in the Physics Layer
var line01 = new Line(Width, 0, 0, 0);
Layer.lines.Add(line01);
var line02 = new Line(0, 0, 0, Height);
Layer.lines.Add(line02);
var line03 = new Line(Width, 0, Width, Height);
Layer.lines.Add(line03);
var line04 = new Line(0, Height, Width, Height);
Layer.lines.Add(line04);
// Adding Springs in the Physics Layer
var link01 = new Spring(Layer.circles[0], Layer.circles[1], 70.0f, 20, 10);
Layer.springs.Add(link01);
var link02 = new Spring(Layer.circles[1], Layer.circles[2], 70.0f, 20, 10);
Layer.springs.Add(link02);
var link03 = new Spring(Layer.circles[2], Layer.circles[0], 70.0f, 20, 10);
Layer.springs.Add(link03);
Now you just need to Update the Physics in the Main Loop
Layer.Update(deltaTime);
And Draw it in Rendering section of the Main Loop,
Layer.Draw();
This is pretty much it, You can have a look at the Examples. There are currently only two examples, Soft Body Simulation in Examples/SoftBodySimulation and Cloth Simulation in Examples/ClothSimulation.
if any kind of help regarding this is needed, you can just mail me.
License
Radius2D is under the MIT License which is why you can do almost anything with projects made with it you want.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- Raylib-cs (>= 4.0.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.