Is it normal for the SCNNode axis to reposition nodes?

I am trying to rotate the block by setting the pivot point in any of the angles, but it seems that setting the pivot point actually rearranges the node, keeping the point exactly where it was ...

eg

SCNBox *box = [SCNBox boxWithWidth:1 height:2 length:1 chamferRadius:0]; SCNNode *node = [SCNNode nodeWithGeometry:box]; node.position = SCNVector3Make(0, 0, 0); [self.scene.rootNode addChildNode:node]; node.pivot = SCNMatrix4MakeTranslation(0.5, -1, 0.5); [node runAction:[SCNAction rotateByAngle:GLKMathDegreesToRadians(90) aroundAxis:SCNVector3Make(0, 0, 1) duration:2]]; 

With node.position 0,0,0 and drawer geometry 1, 2, 1 I would suggest that this block will sit flush with the floor ... what does it do if you don't set the anchor point.

The real question is: how would you set the rotation position of this node without affecting its position, so if, for example, I pressed the right key, it would rotate on the z axis around the lowest right and if I pressed the left key, it would rotate around the bottom left of the point, and also up and down, but along the x axis.

0
source share
1 answer

The pivot property of an SCNNode object SCNNode similar to anchorPoint a CALayer (see Anchor points affect geometric manipulations ). If you want the pivot property to change without a visual effect, you will also have to change its transform (or position ) property.

+2
source

Source: https://habr.com/ru/post/1275738/


All Articles