cancel
Showing results for 
Search instead for 
Did you mean: 

Moving Oculus controller back and forth(along the z axis)

AliHammza
Level 2
Hey,
I have written a script to pick an object with a rigidbody component by the ray casted from the controller and move it around. 
I parent the object to the controller to move it in the scene then. However, I can not move neither the controller nor the object in the forward or backward direction. I can move it up and down or in a circle but I also want to move it along the z axis. 

If anyone could point me in a right direction or help me with this, I would greatly appreciate it!

Thanks in advance.

12 REPLIES 12

Anonymous
Not applicable
In Unreal we have access to "RawSensorData" from which you can read acceleration data, I'm sure Unity does also support this.

AliHammza
Level 2
Hey, could you elaborate a bit please, since I am very new to this.

Anonymous
Not applicable
I am assuming, looking at the tags off your post, you are developing for the Go.
The Go controller does not support '6 degrees of freedom' (6 dof) but is limited to 3 degrees and therefor does not support up/down, left/right, forward/back.

I have tried the the 'GetRawSensorData' method (from the Oculus ) reads acceleration data from the device (the controller in this case)  which you can use to (sortof) determine the direction in which it was moved.
In Unreal this is the signature of the method:
void GetRawSensorData
(
    FVector & AngularAcceleration,
    FVector & LinearAcceleration,
    FVector & AngularVelocity,
    FVector & LinearVelocity,
    float & TimeInSeconds
)
Hope this helps you to find the method in the Unity OVR plugin.

Anonymous
Not applicable
Just spoke to a Unity guy, he gave me these directions:
OVRPlugin.GetNodeAcceleration(OVRPlugin.Node.HandRight, OVRPlugin.Step.Render).FromFlippedZVector3f();
And a snippet from within the OVRPlugin:
if (version >= OVRP_1_12_0.version)
            return OVRP_1_12_0.ovrp_GetNodePoseState(stepId, nodeId).Acceleration;

        if (version >= OVRP_1_8_0.version && stepId == Step.Physics)
            return OVRP_1_8_0.ovrp_GetNodeAcceleration2(0, nodeId).Position;

        return OVRP_0_1_3.ovrp_GetNodeAcceleration(nodeId).Position;




AliHammza
Level 2
Ohh ok. Thank a lot.  The Go controller does not support '6 degrees of freedom' , is there any other way to move object forward/back after parenting it to the controller by pressing the trigger button.

Anonymous
Not applicable
Guess you could do that by pressing the trigger (or measuring the axis value of the trigger?)
I have a setup in which I use the trackpad/thumbpad axis value to move the picked up object forward and backward.

AliHammza
Level 2
i did that by pressing the trigger, but since the go controller does not move back and forth, therefore I can not move the object in that direction either. It only moves up or down or right or left on a circle.

AliHammza
Level 2

VR-Lab-nl said:

Guess you could do that by pressing the trigger (or measuring the axis value of the trigger?)
I have a setup in which I use the trackpad/thumbpad axis value to move the picked up object forward and backward.


Hey, could you please share that setup/script that you used for the movement of the objects along the z axis?

Anonymous
Not applicable

AliHammza said:

i did that by pressing the trigger, but since the go controller does not move back and forth, therefore I can not move the object in that direction either. It only moves up or down or right or left on a circle.



That circular motion is the 3dof in action: you are seeing the registered rotation of the controller.

As for the script, this part was done in Unreal's blueprints:
9wo4lnldmfd1.png

'GetUpDown' gives an axis value from -1 to 1 of the position of your thumb on the pad. 'MaxMoveAmount' is how far the object should move forward (or backward) 'StickLocationZero' is the original position of the object.