2

I am new to sceneform sdk for Android . Currently i am working on a demo in which i have to replace node on the same position of other one, it is working perfectly if both node renderables have the same size and scale. But not working when both nodes have different sizes.

Please check below scenario:

enter image description here enter image description here

As From images What i did is, first added one renderable node(which is bigger in size) .Now i want to add other node(which is smaller) on same position of first one but what happens is, the second object placed on the center of first one. I need it to be placed on the right most side of first object as i displayed in second image.Here is code for replacement of objects:

Vector3 indicatorOnePosition = indicatorOneNode.getLocalPosition(); // where indicatorOneNode is first object
 Quaternion indicatorOneRotation = indicatorOneNode.getLocalRotation(); // getting rotation of first object
 Node secondNode = new Node();
 secondNode.setLocalPosition(indicatorOnePosition);
 secondNode.setLocalRotation(indicatorOneRotation);

Can I do something to 'fix' this?

ImLearning
  • 357
  • 1
  • 3
  • 16
  • You could probably get the collision box size and adjust your anchor of the smaller object by a fixed amount based on the parent collision box size. Otherwise you could determine the plane anchor point of the corner of that collision box and anchor yourself there, but then you would have to offset your self slightly out of the corner so that they don't overlap. – Sam Oct 14 '19 at 14:53

0 Answers0