Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

324
Visualizações
SceneKit – Node with animated skeleton not moving

I have a SceneKit app with 2 .scn files in the art.scnassets folder. The base ship.scn that comes with the project, and a new file orcIdle.scn that I added myself.

When I call this code on this ship, it moves it properly:

self.myScene = SCNScene(named: "art.scnassets/ship.scn")!
// Set the scene to the view
let ship = (myScene.rootNode.childNode(withName: "ship", recursively: false))!
ship.position = SCNVector3(0, 0, -5)
self.sceneView.scene = myScene

When I call the same code on my orcIdle file, it places the orc exactly at (0,0,0)

self.myScene = SCNScene(named: "art.scnassets/orcIdle.scn")!
// Set the scene to the view
let orc = (myScene.rootNode.childNode(withName: "orcIdle", recursively: false))!
orc.position = SCNVector3(0, 0, -5)
self.sceneView.scene = myScene      

here are screenshots of the file node:

This is the default ship file included in the project by Xcode.
enter image description here

This is my orcIdle file.

enter image description here

As you can see, it's the exact same code but 1 moves, and the other doesn't. Also, in the top right corner of the images, i can adjust the Z value there. It works for .ship, but not for .orcIdle.

Is it a scale issue? Any thoughts?

Here's a new screenshot with as much of the scene graph as I can capture. enter image description here

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Usually, you must select a skeleton's top hierarchy (like root node) to move geometry, since its mesh was bound to skeleton. If model's skeleton is considerably deeper in the hierarchy use .childNodes[x] subscript syntax to fetch a desired joint.

But a solution based on your .scn file is the following – create a topNode object and put root and LOD_Group inside it.

enter image description here

So your code should look like this:

let scene = SCNScene(named: "art.scnassets/orcIdle.scn")!
    
orc = scene.rootNode.childNode(withName: "topNode", recursively: true)!
    
orc.position = SCNVector3(0,0,-20)
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda