public static void AlignBottomTo(this SCNNode self, SCNNode from, float offset = 0) { var y = self.ConvertPositionFromNode(new SCNVector3(0, -from.Height() * 0.5F, 0), from).Y + (self.Height() * 0.5F) + offset; self.Position = new SCNVector3(self.Position.X, y, self.Position.Z); }
public static void Center(this SCNNode self) { SCNVector3 min = SCNVector3.Zero, max = SCNVector3.Zero; self.GetBoundingBox(ref min, ref max); self.Pivot = SCNMatrix4.CreateTranslation(min.X + (self.Width() * 0.5F), min.Y + (self.Height() * 0.5F), 0); }