SCNNode Bounding Box

BeanzBeanz Member ✭✭

After guys

I am currently working with the iOS ARKit, I am currently trying to implement a piece of code

func getChildBoundingBox() -> (v1: SCNVector3, v2: SCNVector3) {
let firstChild = self.childNodes[0]
return (firstChild.boundingBox.max, firstChild.boundingBox.min)
}

Using the SceneKit code, I should be able to use the

boundingBox.Min and Max

But these are hidden behind

GetBoundingBox()

Which requires refs but cannot pass itself :neutral:

Should I be using Urho instead of SceneKit as according to this API page

Urho.BoundingBox/

These are exposed in the Urho Lib

Best Answer

Answers

  • ColeXColeX Member, Xamarin Team Xamurai
    edited December 2018

    This is swift function which returns tuples . You can convert it to C# in this way .

        float[] getChildBoundingBox(SCNVector3 v1 , SCNVector3 v2)
        {
            var firstChild = this.childNodes[0];
            return new float[] { firstChild.boundingBox.max, firstChild.boundingBox.min }; 
        }
    

    then you can access the value by

       float[] array = getChildBoundingBox(v1,v2);
       float max = array[0];
       float min = array[1];
    
  • BeanzBeanz Member ✭✭
    edited December 2018

    @ColeX

    Thats great but this does not exist in the xamarin library

    firstChild.boundingBox.max, firstChild.boundingBox.min }

    The only methods / Properties that are exposed are GetBoundingBox()

    So the real question is, what am I meant to be passing as refs

    And it returns a bool :neutral: so not even the values I need lol

  • BeanzBeanz Member ✭✭

    @ColeX

    Cheers, that seems to of got it :smile:

    Long day friday and heavy weekend did not help with my logic :smiley:

Sign In or Register to comment.