How to drag SCNNode along specific axis after rotation?
NickName:ozaneski13 Ask DateTime:2022-08-16T19:00:10

How to drag SCNNode along specific axis after rotation?

I am currently working on Swift ARKit project.

I am trying to figure out how can I drag node object at specific axis even after some rotations. For example I want to move node along Y axis after rotations but It's axis directions stays same so even if I change Y position it's still move along World Y. SCNNode.localup is static and returns SCNVector3(0, 1, 0) and as far as I see there is no function for node's local up. If I remember correctly, it was enough to increase the local axis to drag after rotating in Unity.

Node object before rotation

Before applying some rotations to drag object all you need to do is increasing or decreasing specific axis.

Node object after rotation

After rotate green Y axis rotates too but when I increase or decrease local Y value object still moves along World Y.

Sorry for my bad English. Thanks for your helps.

Copyright Notice:Content Author:「ozaneski13」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/73372921/how-to-drag-scnnode-along-specific-axis-after-rotation

More about “How to drag SCNNode along specific axis after rotation?” related questions

How to drag SCNNode along specific axis after rotation?

I am currently working on Swift ARKit project. I am trying to figure out how can I drag node object at specific axis even after some rotations. For example I want to move node along Y axis after

Show Detail

SCNNode Rotation Multiple Axes

This Question was posted, but never answered. Similar to This Question, I am trying to understand SCNNode.rotation as a 4D vector. The prior question utilizes an example that only manipulates 1 ax...

Show Detail

Scenekit - multiple rotation of SCNNode and direction of axes

I have a SCNNode which i keep on rotating with pan gesture by 90deg increments. The first few rotations are working as intended, by with a scenario where the nodes axes rotate in the oposite direct...

Show Detail

SCNNode rotation around a generic axis with animation

I need to rotate the gray bar around the red dot (see picture below). I managed to do that translating the center point of the bar, rotating the bar and then translating the bar back to the original

Show Detail

How to drag SCNode with finger irrespective of axis using ARKit?

I am working on an AR based application using ARKit. I am using https://developer.apple.com/documentation/arkit/handling_3d_interaction_and_ui_controls_in_augmented_reality as base for this. Using ...

Show Detail

Position SCNNode in front of camera with just one axis of rotation

I'm trying to make an ARKit application where an SCNNode, in this case a box, is placed in front of the camera, facing the camera. As the user moves the camera around, objects are placed when a cer...

Show Detail

How can I calculate a multi-axis SCNVector4 rotation for a SCNNode?

The SCNNode take a rotation using a SCNVector4, which has an angle (w) and a magnitude how that angle applies to each axis (x, y, z). For example, to rotate 45 degrees around the x-axis I'd create a

Show Detail

What is the difference between Orientation and Rotation in SCNNode

I am quite confused by the "rotation" and "orientation" for a SCNNode. In Apple's doc, they are defined quite similarly: orientation: The node’s orientation, expressed as a quaternion. Animatable.

Show Detail

Rotate SCNNode then move relative to rotation?

My node setup: let node = SCNNode() node.position = SCNVector3(0.0, 0.0, 0.0) I then wish to rotate the node by 90 degrees to the left which can be achieved with: node.transform = SCNMatrix4Rotate(

Show Detail

SCNNode (SCNCamera) rotation

I have an SCNView with SCNCamera and SCNNode being set. Initially it looks like this: While I would like it to look like this: How can I set it to be initially in such rotation position? (with c...

Show Detail