@rickster, 3x3 4x4 Swift, simd iOS 11/tvOS 11/High Sierra SceneKit:
extension float4 {
var xyz: float3 {
return float3(x, y, z)
}
init(_ vec3: float3, _ w: Float) {
self = float4(vec3.x, vec3.y, vec3.z, w)
}
}
extension float4x4 {
var upperLeft3x3: float3x3 {
let (a,b,c,_) = columns
return float3x3(a.xyz, b.xyz, c.xyz)
}
init(rotation: float3x3, position: float3) {
let (a,b,c) = rotation.columns
self = float4x4(float4(a, 0),
float4(b, 0),
float4(c, 0),
float4(position, 1))
}
}
, node, :
agent.rotation = node.simdTransform.upperLeft3x3
, node "root" (, , rootNode), node worldTransform:
agent.rotation = node.simdWorldTransform.upperLeft3x3
: node SCNTransaction, node node :
agent.position = node.presentation.simdWorldPosition
agent.rotation = node.presentation.simdWorldTransform.upperLeft3x3
EDIT: , node .
node.simdTransform = float4x4(rotation: agent3d.rotation, position: agent3d.position)
, , node, kinematic, dynamic, node .