Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
upper arm
  • Loading branch information
tatsuya-ogawa committed Mar 18, 2026
commit 1ca1b074a1ce64616f994d831cf95c95964fbd79
14 changes: 7 additions & 7 deletions Example/Example/RealityKitViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,19 @@ final class RealityKitViewController: UIViewController, UIGestureRecognizerDeleg
updateCameraTransform()

let neck = vrmEntity.humanoid.node(for: .neck)
let leftShoulder = vrmEntity.humanoid.node(for: .leftShoulder) ?? vrmEntity.humanoid.node(for: .leftUpperArm)
let rightShoulder = vrmEntity.humanoid.node(for: .rightShoulder) ?? vrmEntity.humanoid.node(for: .rightUpperArm)
let leftUpperArm = vrmEntity.humanoid.node(for: .leftUpperArm)
let rightUpperArm = vrmEntity.humanoid.node(for: .rightUpperArm)

let neckRotation = simd_quatf(angle: 20 * .pi / 180, axis: SIMD3<Float>(0, 0, 1))
let shoulderRotation = simd_quatf(angle: 40 * .pi / 180, axis: SIMD3<Float>(0, 0, 1))
let upperArmRotation = simd_quatf(angle: 40 * .pi / 180, axis: SIMD3<Float>(0, 0, 1))
if let neck {
neck.transform.rotation = neck.transform.rotation * neckRotation
}
if let leftShoulder {
leftShoulder.transform.rotation = leftShoulder.transform.rotation * shoulderRotation
if let leftUpperArm {
leftUpperArm.transform.rotation = leftUpperArm.transform.rotation * upperArmRotation
}
if let rightShoulder {
rightShoulder.transform.rotation = rightShoulder.transform.rotation * shoulderRotation
if let rightUpperArm {
rightUpperArm.transform.rotation = rightUpperArm.transform.rotation * upperArmRotation
}
vrmEntity.setBlendShape(value: 1.0, for: .preset(currentExpression.preset))

Expand Down
4 changes: 2 additions & 2 deletions Example/Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ class ViewController: UIViewController {
node.setBlendShape(value: 1.0, for: .preset(currentExpression.preset))

node.humanoid.node(for: .neck)?.eulerAngles = SCNVector3(0, 0, 20 * CGFloat.pi / 180)
node.humanoid.node(for: .leftShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / 180)
node.humanoid.node(for: .rightShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / 180)
node.humanoid.node(for: .leftUpperArm)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / 180)
node.humanoid.node(for: .rightUpperArm)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / 180)

node.runAction(SCNAction.repeatForever(SCNAction.sequence([
SCNAction.rotateBy(x: 0, y: -0.5, z: 0, duration: 0.5),
Expand Down
14 changes: 7 additions & 7 deletions Example/MacExample/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,19 @@ final class ContentViewModel {

// Adjust pose
let neck = vrmEntity.humanoid.node(for: .neck)
let leftShoulder = vrmEntity.humanoid.node(for: .leftShoulder) ?? vrmEntity.humanoid.node(for: .leftUpperArm)
let rightShoulder = vrmEntity.humanoid.node(for: .rightShoulder) ?? vrmEntity.humanoid.node(for: .rightUpperArm)
let leftUpperArm = vrmEntity.humanoid.node(for: .leftUpperArm)
let rightUpperArm = vrmEntity.humanoid.node(for: .rightUpperArm)

let neckRotation = simd_quatf(angle: 20 * .pi / 180, axis: SIMD3<Float>(0, 0, 1))
let shoulderRotation = simd_quatf(angle: 40 * .pi / 180, axis: SIMD3<Float>(0, 0, 1))
let upperArmRotation = simd_quatf(angle: 40 * .pi / 180, axis: SIMD3<Float>(0, 0, 1))
if let neck {
neck.transform.rotation = neck.transform.rotation * neckRotation
}
if let leftShoulder {
leftShoulder.transform.rotation = leftShoulder.transform.rotation * shoulderRotation
if let leftUpperArm {
leftUpperArm.transform.rotation = leftUpperArm.transform.rotation * upperArmRotation
}
if let rightShoulder {
rightShoulder.transform.rotation = rightShoulder.transform.rotation * shoulderRotation
if let rightUpperArm {
rightUpperArm.transform.rotation = rightUpperArm.transform.rotation * upperArmRotation
}
vrmEntity.setBlendShape(value: 1.0, for: .custom("><"))

Expand Down
14 changes: 7 additions & 7 deletions Example/VisionExample/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,19 @@ final class ImmersiveViewModel {

// Adjust pose
let neck = vrmEntity.humanoid.node(for: .neck)
let leftShoulder = vrmEntity.humanoid.node(for: .leftShoulder) ?? vrmEntity.humanoid.node(for: .leftUpperArm)
let rightShoulder = vrmEntity.humanoid.node(for: .rightShoulder) ?? vrmEntity.humanoid.node(for: .rightUpperArm)
let leftUpperArm = vrmEntity.humanoid.node(for: .leftUpperArm)
let rightUpperArm = vrmEntity.humanoid.node(for: .rightUpperArm)

let neckRotation = simd_quatf(angle: 20 * .pi / 180, axis: SIMD3<Float>(0, 0, 1))
let shoulderRotation = simd_quatf(angle: 40 * .pi / 180, axis: SIMD3<Float>(0, 0, 1))
let upperArmRotation = simd_quatf(angle: 40 * .pi / 180, axis: SIMD3<Float>(0, 0, 1))
if let neck {
neck.transform.rotation = neck.transform.rotation * neckRotation
}
if let leftShoulder {
leftShoulder.transform.rotation = leftShoulder.transform.rotation * shoulderRotation
if let leftUpperArm {
leftUpperArm.transform.rotation = leftUpperArm.transform.rotation * upperArmRotation
}
if let rightShoulder {
rightShoulder.transform.rotation = rightShoulder.transform.rotation * shoulderRotation
if let rightUpperArm {
rightUpperArm.transform.rotation = rightUpperArm.transform.rotation * upperArmRotation
}
vrmEntity.setBlendShape(value: 1.0, for: .custom("><"))

Expand Down
4 changes: 2 additions & 2 deletions Example/WatchExample Watch App/ViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ final class ViewModel: ObservableObject {
let rotationOffset = model.initialRotation
node.eulerAngles = SCNVector3(0, rotationOffset, 0)

node.humanoid.node(for: .leftShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / 180)
node.humanoid.node(for: .rightShoulder)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / -180)
node.humanoid.node(for: .leftUpperArm)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / 180)
node.humanoid.node(for: .rightUpperArm)?.eulerAngles = SCNVector3(0, 0, 40 * CGFloat.pi / -180)

node.runAction(.repeatForever(.sequence([
.wait(duration: 3.0),
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ vrmEntity.setBlendShape(value: 1.0, for: .custom("><"))
```swift
vrmEntity.setBlendShape(value: 1.0, for: .preset(.fun))
let neckRotation = simd_quatf(angle: 20 * .pi / 180, axis: SIMD3<Float>(0, 0, 1))
let shoulderRotation = simd_quatf(angle: 40 * .pi / 180, axis: SIMD3<Float>(0, 0, 1))
let upperArmRotation = simd_quatf(angle: 40 * .pi / 180, axis: SIMD3<Float>(0, 0, 1))
vrmEntity.humanoid.node(for: .neck)?.transform.rotation *= neckRotation
vrmEntity.humanoid.node(for: .leftShoulder)?.transform.rotation *= shoulderRotation
vrmEntity.humanoid.node(for: .rightShoulder)?.transform.rotation *= shoulderRotation
vrmEntity.humanoid.node(for: .leftUpperArm)?.transform.rotation *= upperArmRotation
vrmEntity.humanoid.node(for: .rightUpperArm)?.transform.rotation *= upperArmRotation
```

### Read the thumbnail image
Expand Down