From 53f68bb7b0dce309723675c4b97f726a469031c0 Mon Sep 17 00:00:00 2001 From: Joel Stålnacke Date: Sun, 13 Oct 2024 15:09:24 +0300 Subject: Added more math functions and sanity checks No +/-Inf or NaN in my vectors please :) --- client/Root.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'client/Root.cs') diff --git a/client/Root.cs b/client/Root.cs index b565083..dfbf0da 100644 --- a/client/Root.cs +++ b/client/Root.cs @@ -37,7 +37,8 @@ public partial class Root : Node2D balls[i] = id; Entity *ent; var pos = new Vec2(5f * rng.Next(10), 5f * rng.Next(20)); - var vel = new Vec2(50f + 5f * rng.Next(10), 50f); + var vel = LibDjup.vec2_mul(LibDjup.vec2_normal(new Vec2(50f + 5f * rng.Next(10), 50f)), 25.0f); + GD.Print(vel, " --> ", LibDjup.vec2_length(vel)); ent = LibDjup.world_find_entity(native_world, balls[i]); ent->ball.Position = pos; ent->ball.Velocity = vel; -- cgit v1.2.3