Sorry If my question is silly I am new in SceneKit.
I have added a globe using SCNnode sphere and added pins as a child node for that sphere.
Now when user tap on any child node I want to rotate globe to such angle that my child node will come toward center for camera.
Thanks in advance
Rotate SCNNode if user tap on any child node it will point towards camera
132 Views Asked by Sandeep Singh At
1
There are 1 best solutions below
Related Questions in SCENEKIT
- Create and customize T-shirt using SceneKit
- Multiple SCNActions
- How to Make Xcode Recognize Morph Targets in a DAE File Imported from Blender?
- ARKit combining ARImageAnchor position with offset values
- Fetching the animations added to a SCNNode
- RealityKit: VideoMaterial causing odd outline around transparent video?
- Can't add a SCNNode to the rootNode
- How to screenshot a SCNScene or SceneView?
- Issues with Vertical Stretching and Horizontal Movement in Metal Shading Language Ray Tracing Shader
- Why does AVPlayer doesn't orient video correctly when using SceneKit?
- How to load 3D model to UIView with better quality in iOS Swift?
- Several instances of 3D model with skinner, and duplication of weights/indices information
- SceneKit physicBody angularVelocity as local "body fixed" angular rates
- How to draw 3D circles/ring in RealityKit?
- SCNSkinner.boneIndices access generates GBytes of memory allocation - why?
Related Questions in SCNNODE
- How to get localCoordinates and localNormal of point of mesh(SCNNode) SCNCamera is looking at?
- Swift add custom geometry (view) to scnnode in SceneKit
- SceneKit - render surface normal of a geometry
- Swift Modify SCNode children
- Swift Prevent Scene point of view reset prior to Camera Action
- Execute function from SwiftUI view to view controller
- Performing gesture on view prevents camera action
- Detect touches and ignore other gestures Swift SceneKit
- Rotate and Move Camera around object does not work Swift SceneKit
- Swift - Detect Tap on child SCNNode not Parent
- Swift (SCNCamera) lock Globe rotation around axis
- Align SCNText Along SCNCylinder
- How to determine size of SCNPlane to cover entire SKScene
- How to run .fadeOut for mesh of the building without walls becoming semi-transparent during the animation? (SceneKit)
- How to Fix SCNNode Transform Problem with CABasicAnimation in SceneKit in Swift?
Related Questions in CHILD-NODES
- Extra text node in nodelist?
- I implement google translate button (google_translate_element) using script tag but it's working on only one page, other page getting empty div
- javascript childNodes - how to get values? whi a console.logged value return undefined?
- return the index of childnode when clicked
- How to find the visible text from a div
- Why doesn´t the childNodes work in my JavaScript code?
- How to get text nodes and tagged nodes out of contents of a Div element in javascript?
- How to use Perl LibXML to add a ChildNode where one is missing?
- Cannot read properties of undefined (reading 'childNodes')
- SpriteKit childnode(withname: String) return nil
- Why when childNodes is used, text and comment reutrns?
- Retrieve particular child node using xpath in java
- child templates in custom component v-data-table
- python api json childnode into pandas dataframe
- Rotate SCNNode if user tap on any child node it will point towards camera
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
If I'm understanding correctly, tap on any child and the globe rotates such that it faces you. I "think" you can do it this way.
Provided you have placed your child nodes accurately and they are pointing away from the center, then have lookat constraints on all of your children but set them to empty. Once one is clicked, set the lookat constraint on that child node and point it at the camera node.
The more difficult part may be to make sure your child nodes are actually facing away from the center because it will matter. IE: Poke a pencil in a ball and rotate it in your hand. The point of the pencil matters because it's glued to your parent object exactly how you placed it initially. If it was facing the center point of your globe for example, then you'd get the opposite effect.
One way to test it is to create the child nodes with a pointer - in this case, it's just a turret from one of my games.
Once you have placed these on your globe and they are rotated correctly, setting lookat constraints "should" work. It should look kind of like a pin cushion (sorry, only example I can think of), and then your globe should rotate towards the camera.
Hopefully