summaryrefslogtreecommitdiff
path: root/client/Root.cs
diff options
context:
space:
mode:
authorJoel Stålnacke <joel@saker.fi>2024-10-13 15:09:24 +0300
committerJoel Stålnacke <joel@saker.fi>2024-10-13 15:09:24 +0300
commit53f68bb7b0dce309723675c4b97f726a469031c0 (patch)
treebb156bf099abd5b054822bb7a0cc59cd1ec036c7 /client/Root.cs
parent6a9b5df8b5ed811fbfde9c78f2599247751a650f (diff)
Added more math functions and sanity checks
No +/-Inf or NaN in my vectors please :)
Diffstat (limited to 'client/Root.cs')
-rw-r--r--client/Root.cs3
1 files changed, 2 insertions, 1 deletions
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;