add 2D physics (use box2d), fixed some little bugs

This commit is contained in:
2025-12-12 16:47:04 +08:00
parent 804c1d84ce
commit 4140a5b4be
27 changed files with 805 additions and 64 deletions

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Prism;
namespace Example
{
class RandomColor : Entity
{
void OnCreate()
{
Random random = new Random();
MeshComponent meshComponent = GetComponent<MeshComponent>();
MaterialInstance material = meshComponent.Mesh.GetMaterial(0);
float r = (float)random.NextDouble();
float g = (float)random.NextDouble();
float b = (float)random.NextDouble();
material.Set("u_AlbedoColor", new Vec3(r, g, b));
}
}
}