Using pan gesture how to do smooth drawing on ARSCNViewHow to change the name of an iOS app?How to check for an active Internet connection on iOS or macOS?How can I make a UITextField move up when the keyboard is present - on starting to edit?How to “add existing frameworks” in Xcode 4?How can I disable ARC for a single file in a project?How to download Xcode DMG or XIP file?How to call Objective-C code from SwiftWhy don't use var at the beginning?UIScrollView cannot display image either in Portrait or Landscape modeSmooth object rotation in ARSCNView

Riley's, assemble!

Pros and cons of writing a book review?

Can Green-Flame Blade be cast twice with the Hunter ranger's Horde Breaker ability?

Count down from 0 to 5 seconds and repeat

What happens if you do emergency landing on a US base in middle of the ocean?

If Boris Johnson were prosecuted and convicted of lying about Brexit, can that be used to cancel Brexit?

Word for a small burst of laughter that can't be held back

Chopin: marche funèbre bar 15 impossible place

Do manufacturers try make their components as close to ideal ones as possible?

Bent spoke design wheels — feasible?

Incremental Ranges!

The ring of global sections of a regular scheme

My coworkers think I had a long honeymoon. Actually I was diagnosed with cancer. How do I talk about it?

Is the decompression of compressed and encrypted data without decryption also theoretically impossible?

Is the capacitor drawn or wired wrongly?

Traffic law UK, pedestrians

I wrote a scene that the majority of my readers loved. How do I get back to that place while writing my new book?

Do adult Russians normally hand-write Cyrillic as cursive or as block letters?

California: "For quality assurance, this phone call is being recorded"

Explain Ant-Man's "not it" scene from Avengers: Endgame

Is it legal in the UK for politicians to lie to the public for political gain?

Does the growth of home value benefit from compound interest?

Why don't B747s start takeoffs with full throttle?

What is the advantage of carrying a tripod and ND-filters when you could use image stacking instead?



Using pan gesture how to do smooth drawing on ARSCNView


How to change the name of an iOS app?How to check for an active Internet connection on iOS or macOS?How can I make a UITextField move up when the keyboard is present - on starting to edit?How to “add existing frameworks” in Xcode 4?How can I disable ARC for a single file in a project?How to download Xcode DMG or XIP file?How to call Objective-C code from SwiftWhy don't use var at the beginning?UIScrollView cannot display image either in Portrait or Landscape modeSmooth object rotation in ARSCNView






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to draw smooth attached lines on ARSCNView, I have tried SCNNode and SCNSphere but it shows dotted line rather than single whole line. When I get my camera closer to the line it literally seems dotted and distributed



enter image description hereenter image description here



I have tried some accepted answers from other users but it does not produce what want, Please check my code below.



import UIKit
import ARKit

class DrawingView:UIViewController,ARSCNViewDelegate

//MARK: Class properties
lazy var sceneView:ARSCNView=
let sv = ARSCNView()
sv.delegate = self
let panToDrawGesture = UIPanGestureRecognizer(target: self, action: #selector(createNodesFromPan(_:)))
sv.addGestureRecognizer(panToDrawGesture)
return sv
()

//MARK: Lifecycle methods
override func viewDidLoad()
super.viewDidLoad()
self.setUpViews()


override func viewWillAppear(_ animated: Bool)
super.viewWillAppear(animated)
let configuration = ARWorldTrackingConfiguration()
sceneView.session.run(configuration)



override func viewWillDisappear(_ animated: Bool)
super.viewWillDisappear(animated)
sceneView.session.pause()



//MARK: Class methods

func setUpViews()
self.view.backgroundColor = .lightGray

self.title = "Drawing"

self.view.addSubview(sceneView)
sceneView.frame = self.view.frame




//MARK: Other methods

@objc func createNodesFromPan(_ gesture: UIPanGestureRecognizer)

let currentTouchPoint = gesture.location(in: self.sceneView)

guard let featurePointHitTest = self.sceneView.hitTest(currentTouchPoint, types: .featurePoint).first else return

let worldCoordinates = featurePointHitTest.worldTransform

let sphereNode = SCNNode()

let sphereNodeGeometry = SCNSphere(radius: 0.005)
sphereNodeGeometry.firstMaterial?.diffuse.contents = UIColor.blue
sphereNode.geometry = sphereNodeGeometry

sphereNode.position = SCNVector3(worldCoordinates.columns.3.x, worldCoordinates.columns.3.y, worldCoordinates.columns.3.z)
self.sceneView.scene.rootNode.addChildNode(sphereNode)




I am trying to achieve smooth drawing lines which does not look dotted or distributed.










share|improve this question




























    0















    I am trying to draw smooth attached lines on ARSCNView, I have tried SCNNode and SCNSphere but it shows dotted line rather than single whole line. When I get my camera closer to the line it literally seems dotted and distributed



    enter image description hereenter image description here



    I have tried some accepted answers from other users but it does not produce what want, Please check my code below.



    import UIKit
    import ARKit

    class DrawingView:UIViewController,ARSCNViewDelegate

    //MARK: Class properties
    lazy var sceneView:ARSCNView=
    let sv = ARSCNView()
    sv.delegate = self
    let panToDrawGesture = UIPanGestureRecognizer(target: self, action: #selector(createNodesFromPan(_:)))
    sv.addGestureRecognizer(panToDrawGesture)
    return sv
    ()

    //MARK: Lifecycle methods
    override func viewDidLoad()
    super.viewDidLoad()
    self.setUpViews()


    override func viewWillAppear(_ animated: Bool)
    super.viewWillAppear(animated)
    let configuration = ARWorldTrackingConfiguration()
    sceneView.session.run(configuration)



    override func viewWillDisappear(_ animated: Bool)
    super.viewWillDisappear(animated)
    sceneView.session.pause()



    //MARK: Class methods

    func setUpViews()
    self.view.backgroundColor = .lightGray

    self.title = "Drawing"

    self.view.addSubview(sceneView)
    sceneView.frame = self.view.frame




    //MARK: Other methods

    @objc func createNodesFromPan(_ gesture: UIPanGestureRecognizer)

    let currentTouchPoint = gesture.location(in: self.sceneView)

    guard let featurePointHitTest = self.sceneView.hitTest(currentTouchPoint, types: .featurePoint).first else return

    let worldCoordinates = featurePointHitTest.worldTransform

    let sphereNode = SCNNode()

    let sphereNodeGeometry = SCNSphere(radius: 0.005)
    sphereNodeGeometry.firstMaterial?.diffuse.contents = UIColor.blue
    sphereNode.geometry = sphereNodeGeometry

    sphereNode.position = SCNVector3(worldCoordinates.columns.3.x, worldCoordinates.columns.3.y, worldCoordinates.columns.3.z)
    self.sceneView.scene.rootNode.addChildNode(sphereNode)




    I am trying to achieve smooth drawing lines which does not look dotted or distributed.










    share|improve this question
























      0












      0








      0








      I am trying to draw smooth attached lines on ARSCNView, I have tried SCNNode and SCNSphere but it shows dotted line rather than single whole line. When I get my camera closer to the line it literally seems dotted and distributed



      enter image description hereenter image description here



      I have tried some accepted answers from other users but it does not produce what want, Please check my code below.



      import UIKit
      import ARKit

      class DrawingView:UIViewController,ARSCNViewDelegate

      //MARK: Class properties
      lazy var sceneView:ARSCNView=
      let sv = ARSCNView()
      sv.delegate = self
      let panToDrawGesture = UIPanGestureRecognizer(target: self, action: #selector(createNodesFromPan(_:)))
      sv.addGestureRecognizer(panToDrawGesture)
      return sv
      ()

      //MARK: Lifecycle methods
      override func viewDidLoad()
      super.viewDidLoad()
      self.setUpViews()


      override func viewWillAppear(_ animated: Bool)
      super.viewWillAppear(animated)
      let configuration = ARWorldTrackingConfiguration()
      sceneView.session.run(configuration)



      override func viewWillDisappear(_ animated: Bool)
      super.viewWillDisappear(animated)
      sceneView.session.pause()



      //MARK: Class methods

      func setUpViews()
      self.view.backgroundColor = .lightGray

      self.title = "Drawing"

      self.view.addSubview(sceneView)
      sceneView.frame = self.view.frame




      //MARK: Other methods

      @objc func createNodesFromPan(_ gesture: UIPanGestureRecognizer)

      let currentTouchPoint = gesture.location(in: self.sceneView)

      guard let featurePointHitTest = self.sceneView.hitTest(currentTouchPoint, types: .featurePoint).first else return

      let worldCoordinates = featurePointHitTest.worldTransform

      let sphereNode = SCNNode()

      let sphereNodeGeometry = SCNSphere(radius: 0.005)
      sphereNodeGeometry.firstMaterial?.diffuse.contents = UIColor.blue
      sphereNode.geometry = sphereNodeGeometry

      sphereNode.position = SCNVector3(worldCoordinates.columns.3.x, worldCoordinates.columns.3.y, worldCoordinates.columns.3.z)
      self.sceneView.scene.rootNode.addChildNode(sphereNode)




      I am trying to achieve smooth drawing lines which does not look dotted or distributed.










      share|improve this question














      I am trying to draw smooth attached lines on ARSCNView, I have tried SCNNode and SCNSphere but it shows dotted line rather than single whole line. When I get my camera closer to the line it literally seems dotted and distributed



      enter image description hereenter image description here



      I have tried some accepted answers from other users but it does not produce what want, Please check my code below.



      import UIKit
      import ARKit

      class DrawingView:UIViewController,ARSCNViewDelegate

      //MARK: Class properties
      lazy var sceneView:ARSCNView=
      let sv = ARSCNView()
      sv.delegate = self
      let panToDrawGesture = UIPanGestureRecognizer(target: self, action: #selector(createNodesFromPan(_:)))
      sv.addGestureRecognizer(panToDrawGesture)
      return sv
      ()

      //MARK: Lifecycle methods
      override func viewDidLoad()
      super.viewDidLoad()
      self.setUpViews()


      override func viewWillAppear(_ animated: Bool)
      super.viewWillAppear(animated)
      let configuration = ARWorldTrackingConfiguration()
      sceneView.session.run(configuration)



      override func viewWillDisappear(_ animated: Bool)
      super.viewWillDisappear(animated)
      sceneView.session.pause()



      //MARK: Class methods

      func setUpViews()
      self.view.backgroundColor = .lightGray

      self.title = "Drawing"

      self.view.addSubview(sceneView)
      sceneView.frame = self.view.frame




      //MARK: Other methods

      @objc func createNodesFromPan(_ gesture: UIPanGestureRecognizer)

      let currentTouchPoint = gesture.location(in: self.sceneView)

      guard let featurePointHitTest = self.sceneView.hitTest(currentTouchPoint, types: .featurePoint).first else return

      let worldCoordinates = featurePointHitTest.worldTransform

      let sphereNode = SCNNode()

      let sphereNodeGeometry = SCNSphere(radius: 0.005)
      sphereNodeGeometry.firstMaterial?.diffuse.contents = UIColor.blue
      sphereNode.geometry = sphereNodeGeometry

      sphereNode.position = SCNVector3(worldCoordinates.columns.3.x, worldCoordinates.columns.3.y, worldCoordinates.columns.3.z)
      self.sceneView.scene.rootNode.addChildNode(sphereNode)




      I am trying to achieve smooth drawing lines which does not look dotted or distributed.







      ios swift xcode augmented-reality arkit






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 13:05









      indrajitindrajit

      1198




      1198






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55324085%2fusing-pan-gesture-how-to-do-smooth-drawing-on-arscnview%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55324085%2fusing-pan-gesture-how-to-do-smooth-drawing-on-arscnview%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript