1

I'm trying to create a node in xcode that will combine 2 of my models that I'm fetching from RC Scene.

myTrack
myCar

they both been aligned individually but they are a bit too big. Car is using a loop that is controlling it movement around the track using JSON.

I want to add them to one root node and mange scale from there using

let mainAnchor = AnchorEntity(world: [0, 0, 0])
    
self.arView.scene.addAnchor(mainAnchor)
myTrackTransformed.addChild(mainAnchor)
myCar.addChild(mainAnchor)
    
mainAnchor.scale = [0.1, 0.1, 0.1]

but whatever I put in scale values they do nothing. Any ideas why?

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220

1 Answers1

1

The anchor must be a parent node, not vice versa:

let mainAnchor = AnchorEntity()
    
mainAnchor.addChild(myTrack)
mainAnchor.addChild(myCar)
self.arView.scene.addAnchor(mainAnchor)
    
mainAnchor.scale /= 10

But remember that you need to extract the model entities (myTrack and myCar) from the Reality Composer scene (RCScene.rcproject).

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220