/// <summary> /// Calculate the corner positions based on the transform of the parent object /// </summary> /// <param name="parentTransform">Transformation of the parent</param> public void UpdateTransform(Transform parentTransform) { //init array if its still uninitialized if (Position == null) Position = new Vector2f[4]; //for every corner for(int i=0;i<4;++i) { //translate the base corner with the parents transform Position[i]=parentTransform.TransformPoint(BatchedDrawable.Corners[i]); } }
public Vector2f GetCenter(Transform transform) { return transform.TransformPoint(Position + size / 2); }