3
我似乎無法弄清楚如何使用SCNTransformConstraint
約束節點的Z值。這是迄今爲止我所擁有的。如何使用SCNTransformConstraint來限制節點的Z值?
let constraint = SCNTransformConstraint(inWorldSpace: true, withBlock:{
node, matrix in
var newMatrix = matrix
let currentNode = node as SCNNode
if (currentNode.presentationNode().position.z > 0.0) {
newMatrix.m43 = 0.0
}
return newMatrix
})
ship.constraints = [constraint]
上述約束,ship
當我施加力,其physicsBody
不動。任何幫助將不勝感激。
這幫了我。雖然,我第一次嘗試安東尼泰勒的建議。這讓我在屏幕上出現了某種抖動。使用你以上的最小z高度約束爲我工作。謝謝... – xBACP