HTC Vive, Unity VR, change acceleration of controllers - unity3d

I am doing some programming with the HTC Vive in Unity using the SteamVR plugin and I have a simple program where I am hitting boxes around. I now want to add another functionallity but after searching around for an hour I am no closer to figuring out how to approach this.
I want to change the acceleration of the controllers on a specific axis. For example, if I increased the positive Y-axis and flapped my arms up and down, the controllers would end up at head level at one point even though my arms are by my side. How do I do this? Is there a way to change the acceleration for the controllers?
If I can't actually change the acceleration of the controllers, is there a way to change the position of the controller permanently so it doesn't snap back? If so then I could achieve the same effect.
Thanks in advance.

Related

How to modify behaviour of a VR controller's pointer

My university colleagues and I are trying to develop a Virtual Reality project for university where we use an Oculus headset and create a scene with a mouse where you can select and click and drag different objects in the scene. You are supposed to be stationary and move one of the controllers as if it was a mouse. However, we want to modify the behaviour of the controller to better fit the 3D environment. When an object is not selected, we want to interpolate the depth of the cursor according to the interpolation of the nearest objects. There is a paper that we were shown in class that we are supposed to drag inspiration from, and it achieved this kind of behaviour of the cursor with a normal mouse but I can't seem to find any information on how they did it. Our final goal would be to compare both ways of managing the scene and assess which one is better. We are using Unity with VRTK as suggested by our professor, but we and can't really seem to be able to access the mouse's file on how it moves or its behaviour, and we are kind of lost on where to go. Could someone help with this?
Here is the paper where they talk about it:
https://dl.acm.org/doi/pdf/10.1145/3491102.3501884
We so far have tried creating a simple scene and adding objects with different behaviours as well as a controller instance, but we seem to only be able to modify the events of the mouse and not its specific behaviour.
Kind regards and thanks

How to make an object bend in the opposite direction as it moves into Unity

I need to move a 3D object like in the "Run sausage" game.
https://www.youtube.com/watch?v=CQa5PUlSfwk
There, as the character runs forward, its body kind of bends backwards, in the direction opposite to the movement.
In particular I do a simulation of a tornado in Unity, but when I want to go forward to the upper part of the tornado moved back, and after 1 second reaches the lower part ("legs")
Any suggestions would help me. Thank you
The movement like in the Sausage Run game can be achieved easily by using animator controller specifically Blend Tree. Watch this tutorial is you are not already familiar with these
https://www.youtube.com/watch?v=E-zQw4GabKw

Align HTC Vive Coordinate with OptiTrack System in Unity

I am working on aligning HTC Vive Controller (for example, right controller) with a rigid body marker which is tracked by Optitrack. Since the coordinate system of both systems are different how can I align these two systems? I am trying to move the rigid body marker similar to the right-hand controller of the htc vive.
Scenario:
I have a unity environment which is viewed using HTC Vive and now I want to have a rigid body marker which is tracked by Optitrack and have to align properly while I move the marker in the environment.
Any suggestions would be very helpful.
Thank you.
I am currently facing the same problem and have no solution yet, but some ideas:
1st idea match the centers
When you calibrate OptiTrack you set the center of your OptiTrack Space.
Maybe you can track the OptiTrack center point with the vive controller and then shift the vive's coordinate space appropriately.
I don't have an idea how to solve the rotation missmatch, maybe you have one?
2nd idea track some reference points with both systems
If you have the possibility to track 4 reference points in both systems, you should be able to define a transformation matrix from one vector space to the other.
For now, i have not tried the ideas, but i will soon.
Have you found a solution yet?

How to create directional drag in Unity?

I'm developing a game in which you race in ships that are hovering above the ground. The problem is that they are really difficult to control because the have no friction other than the drag i set in Rigidbody component. Because of that steering is very unresponsive. Setting drag to really high values helps but it works in all directions and thats not what I want. The solution would be making the drag work only sideways so steering is easier, but going forward and backward is normal. Do you know how can I achieve this?
What's your code? Are you adding force by using rigidbody.AddForce? You know that it accepts a second parameter ForceMode.
For example:
rigidbody.addForce(Vector3.up, ForceMode.VelocityChange)
This wil add an instant force, ignoring it's mass. To see other ForceModes, look here :)

Normalize Vector3.Distance based on rotation

I am trying to measure distance between multiple positions but I do not want the rotation to affect the distance. In concept, I want to track the starting transform and upon each update track the distance traveled without regard to the change in rotation. I am using an HTC Vive controller and people tend to rotate their hands and I want to control for this.
I've tried resetting the Eular Angles, but this doesn't seem to work.
Adding an Analogy that will certainly help.
Think of it like trying to draw and measure a line with a pencil, the position is in the eraser, and I can hold the pencil in any number of ways and in fact change the position in the middle of drawing the line, but my line will remain straight and the measurement will remain accurate.
Any help is appreciated.
I believe your problem lies around the position you are tracking. It sounds like you are tracking the transform.position of one of the child elements of the Vive controller model, leading to the situation that you're describing with the pencil eraser analogy.
Depending on where your script is attached, you could either move this to the top level element of the Vive controller, or alter your script to instead track transform.parent.position, which shouldn't be affected by the rotations of someone's hand.