-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
At the moment, when you create a chain using B2Shapes.b2CreateChain, it returns a B2ChainId instead of a B2ShapeId. This not only breaks the api's convention but also makes it difficult to create proper abstractions around shape creation.
Since both structs share the same structure, using B2ShapeId instead of B2ChainId for chains will "just work."
These two are essentially the same:
public readonly struct B2ChainId
{
public readonly int index1;
public readonly ushort world0;
public readonly ushort generation;
public B2ChainId(int index1, ushort world0, ushort generation)
{
this.index1 = index1;
this.world0 = world0;
this.generation = generation;
}
}
And
public readonly struct B2ShapeId
{
public readonly int index1;
public readonly ushort world0;
public readonly ushort generation;
public B2ShapeId(int index1, ushort world0, ushort generation)
{
this.index1 = index1;
this.world0 = world0;
this.generation = generation;
}
public override string ToString()
{
return $"(i:{index1}, w:{world0}, g:{generation})";
}
}
Metadata
Metadata
Assignees
Labels
No labels