Posts

Post not yet marked as solved
2 Replies
0 Views
I am just documenting my discoveries in case it is of use to anyone else but I managed to perform a raycast from the node so that it detects things other than its child nodes, I run this function on update but I am not sure if there is a more efficient way of doing it. func heightTest(){         let result = sceneNode?.hitTestWithSegment(from: sceneNode!.position, to: SCNVector3(x: sceneNode!.position.x, y: -100, z: sceneNode!.position.z), options: [SCNHitTestOption.rootNode.rawValue: scene.rootNode])         if let intersection = result?.first?.simdWorldCoordinates {             print(intersection)         }     }
Post not yet marked as solved
2 Replies
0 Views
I have semi sorted it by setting constraints to the Y value by using the following code in the RenderComponent of the entity;         let heightConstraint = SCNTransformConstraint.positionConstraint(inWorldSpace: false) { (node, position) in             var constrainedPosition = position             if position.y > 0 { constrainedPosition.y = 0; node.position.y = 0}             if position.y < 0 { constrainedPosition.y = 0; node.position.y = 0}             return constrainedPosition         }         node.constraints = [heightConstraint] I am wanting to have these agents move around on a landscape so they won't be on straight flat ground, my hope was to find a way of having the update routine for the node perform a raycast to check the height of the ground below it so it could move up and down and not be constrained to a static height but the node raycast only returns child objects of the node which the ground would not be so I have to come up with a new method if there is one.
Post not yet marked as solved
1 Replies
0 Views
Is this what you mean? https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
Post marked as solved
4 Replies
0 Views
Im a beginner so this might not be the best answer but couldn't you just keep it as a string and wherever it is being used just just check it with if (stats.value != nil) { use stats.value as an Int } else { use stats.value as a String }