arch_il
arch_il
CC#
Created by arch_il on 1/25/2024 in #help
✅ How to force C# to copy data?
thanks
10 replies
CC#
Created by arch_il on 1/25/2024 in #help
✅ How to force C# to copy data?
this is the part where the reference is created.
10 replies
CC#
Created by arch_il on 1/25/2024 in #help
✅ How to force C# to copy data?
is there a function for creating a deep copy of an object or do I have to make a new object myself?
10 replies
CC#
Created by arch_il on 1/25/2024 in #help
✅ How to force C# to copy data?
public static void ReloadRooms()
{
using (System.IO.StreamReader sr = new System.IO.StreamReader("Rooms.json"))
{
GlobalValues.rooms.Clear();

var data = JsonSerializer
.Deserialize<JsonReceiver>(
sr.ReadToEnd(),
new JsonSerializerOptions { IncludeFields = true }
).ParseData();

checkpoints = data.Item1;
rooms = backup_rooms = data.Item2;
}
}
public static void ReloadRooms()
{
using (System.IO.StreamReader sr = new System.IO.StreamReader("Rooms.json"))
{
GlobalValues.rooms.Clear();

var data = JsonSerializer
.Deserialize<JsonReceiver>(
sr.ReadToEnd(),
new JsonSerializerOptions { IncludeFields = true }
).ParseData();

checkpoints = data.Item1;
rooms = backup_rooms = data.Item2;
}
}
10 replies
CC#
Created by arch_il on 12/10/2023 in #help
✅ Confused about publish options
thanks
6 replies
CC#
Created by arch_il on 11/23/2023 in #help
2d collision, Chaotic Ball
instead of fiddling around with vectors, i decided to find an angle of resulting velocity and then convert polar coordinate to traditional form. With some fiddling around, this works great.
26 replies
CC#
Created by arch_il on 11/23/2023 in #help
2d collision, Chaotic Ball
hey @exokem . thanks for help. here is solution i came up with today.
if (position.Length() >= radius)
{
double ratio = radius / position.Length();
position *= ratio;

double collision_angle = Math.Acos(position.X / radius);
double vector_angle = Math.Atan2(velocity.Y, velocity.X) + Math.PI;
double new_angle = 2 * collision_angle - vector_angle;
double vlen = velocity.Length();

velocity = new Vec2(-Math.Cos(new_angle), Math.Sin(new_angle)) * vlen;
}
if (position.Length() >= radius)
{
double ratio = radius / position.Length();
position *= ratio;

double collision_angle = Math.Acos(position.X / radius);
double vector_angle = Math.Atan2(velocity.Y, velocity.X) + Math.PI;
double new_angle = 2 * collision_angle - vector_angle;
double vlen = velocity.Length();

velocity = new Vec2(-Math.Cos(new_angle), Math.Sin(new_angle)) * vlen;
}
26 replies
CC#
Created by arch_il on 11/23/2023 in #help
2d collision, Chaotic Ball
anyways its late for me. will try implementing tomorrow. thanks a bunch
26 replies
CC#
Created by arch_il on 11/23/2023 in #help
2d collision, Chaotic Ball
that is much neater solution
26 replies
CC#
Created by arch_il on 11/23/2023 in #help
2d collision, Chaotic Ball
what can i do to fix that? nudge the ball towards center until it is inside bounds?
26 replies
CC#
Created by arch_il on 11/23/2023 in #help
2d collision, Chaotic Ball
my logic is that if y is out of bounds, x will be too
26 replies
CC#
Created by arch_il on 11/23/2023 in #help
2d collision, Chaotic Ball
I made mistake somewhere, so it doesn't work on the right side. Couldn't find issue there either
26 replies
CC#
Created by arch_il on 11/23/2023 in #help
2d collision, Chaotic Ball
yes
26 replies
CC#
Created by arch_il on 11/23/2023 in #help
2d collision, Chaotic Ball
i attempted this
26 replies
CC#
Created by arch_il on 11/23/2023 in #help
2d collision, Chaotic Ball
No description
26 replies
CC#
Created by arch_il on 11/23/2023 in #help
2d collision, Chaotic Ball
motion vector
26 replies
CC#
Created by arch_il on 11/23/2023 in #help
2d collision, Chaotic Ball
thanks. that's better way for triggering, but trigger was never really the issue. I had both cases together, but split them up in the process of trying to get it right.
26 replies
CC#
Created by arch_il on 8/22/2023 in #help
❔ How does class casting work?
can i define it somewhere?
11 replies
CC#
Created by arch_il on 8/22/2023 in #help
❔ How does class casting work?
but adding Boo to list of Foo works just fine
11 replies
CC#
Created by arch_il on 8/10/2023 in #help
❔ I just can't even start to think what has gone wrong.
i checked every difference that could have happened, but they both seem to follow same path
23 replies