Improbable Icon

Enable specific Coordinate systems through subclassing Coordinates class

unity
v9-0-0

#1

Currently, the Coordinates class is a sealed class, meaning that I am unable to subclass it. In my game, I have to deal with various coordinate systems due to differences in distances and sizes. I wanted to created a few subclasses of Coordinates to accurately represent with which Coordinate set I was dealing, and to introduce specific helpers (such as conversions from one to another). Would this be possible? Or would this conflict with the type hinting in other parts of the system?


#2

Hmm, this is an old topic and I presume you have done something similar to what I’m about to suggest, but just in case you are still interested - I think your best bet here is to create whatever position types you need for your simulation’s representation of position and to convert to Coordinates when synchronising to SpatialOS.


#3

I have left the topic after I posted this since v9 came out and the associated refactoring took a long time. Your advice does seem like what I was working with, in combination with Extension methods to attach conversion methods to the Coordinates and Vector3 class