Skip to content

Instantly share code, notes, and snippets.

View factoryhr's full-sized avatar

Factory.dev factoryhr

View GitHub Profile
func createPhysicsBody(for node: SCNNode){
let boxGeomtery = SCNBox(width: 0.2, height: 0.2, length: 0.2, chamferRadius: 0)
let physicsShape = SCNPhysicsShape(geometry: boxGeomtery, options: nil)
let physicsBody = SCNPhysicsBody(type: .kinematic, shape: physicsShape)
node.physicsBody = physicsBody
}
func moveNode(node: SCNNode){
let moveAction = SCNAction.move(to: SCNVector3(0.1, 0.1, 0.1), duration: 0.25)
node.runAction(moveAction)
}
func createNode(){
let boxGeometry = SCNBox(width: 0.2, height: 0.2, length: 0.2, chamferRadius: 0)
let node = SCNNode(geometry: boxGeometry)
sceneView.scene.rootNode.addChildNode(node)
}
func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
//Check that anchor is plane anchor that represents planar surfaces
guard let planeAnchor = anchor as? ARPlaneAnchor else { return }
//Create node using anchor position
let boxNode = createNode(with: planeAnchor)
//Add boxNode as a child node to newly found node
node.addChildNode(boxNode)
}
func createNode(with anchor: ARPlaneAnchor) -> SCNNode{
import UIKit
import ARKit
import SceneKit
class ARViewController: UIViewController{
// First we create instances of ARSCNView, ARSession and ARWorldTracking configuration
let sceneView: ARSCNView = {
let scene = ARSCNView()
scene.translatesAutoresizingMaskIntoConstraints = false
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
// …
/*
* @Route(“/tag/show/{id}”, name=”show_tag”)
* @param Request $request
* @param $id
$tagListing = new \Pimcore\Model\Element\Tag\Listing();
$tagListing->addConditionParam(‘name LIKE :term’, [‘term’ => ‘%’ . $term . ’%’]);
$objectList = [];
foreach ($tagListing as $tag) {
$taggedObjects = \Pimcore\Model\Element\Tag::getElementsForTag($tag, ‘object’);
$tag = new \Pimcore\Model\Element\Tag();
$tag->setName(‘keyword’)->save();
\Pimcore\Model\Element\Tag::addTagToElement(‘object’, 156, $tag);
$objects = \Pimcore\Model\Element\Tag::getElementsForTag($tag, ‘object’);
$availableObjects = [];
foreach ($objects as $object) {
$availableObjects[] = $object;
}
$tags = \Pimcore\Model\Element\Tag::getTagsForElement('document', 4);
$availableKeywords = [];
foreach ($tags as $tag) {
$availableKeywords[$tag->getId()] = $tag->getName();
}
$this->view->$availableKeywords;