Multiple Rotations instead of -180 , 180

Hi

I have a wheel, that I can rotate using my hand in VR.
The wheel can rotate freely, but the rotations its making is limited to min -180 max 180
The second you go over 180 degrees, it switches to -180. I would like this to continue, so that I can customize the wheel to allow rotations up to 1000 degrees, and if you go above 1000 degrees, it starts at -1000 perhaps. ( preferably stops, but thats another thing)

How can I do this? No matter how I’ve tried changing the numbers, It only really changes the output, be it from -180 - 180 to -360 - 360 ( but twice the rotational speed than what I am inputting )

Here is the current blueprint of how the rotation is done.
This is taking vector coordinates from a project to plane ( which is a point relative to the wheel base below the controller, and the wheel base location )
I am then setting the Relative Rotation of the wheel. The movement of the wheel is exactly how I want it, but I want the amount of rotations it does to be multiple instead of rotating to -180 degrees and then flipping to 180 degrees again.

Here it is in action with the output printed.
The output is the input rotation angle / 180 ( which is the max angle number )
changing this value will increase how many rounds it takes, but it will rotate faster than my hand is…

I hope I’m making sense. Thanks

1 Like

There’s two ways to do this:

1. Code the mechanics only in terms of adding or subtracting rotation amounts. So never try and set an absolute value.

2. Use quaternions. I -think- ( can’t check right now ), that this is now available in blueprint. If it isn’t, then you can use a plugin, or switch to C++.

2 Likes

I’m unsure how best to code this to use addition / subtraction instead of setting the rotation, as I’m getting the rotation from a Find Look At Rotation.

It IS available in Blueprint, but I have no idea how to work with Quaternions.
Any idea how I can use the nodes to do what I’d like to acheive?
kinda hoping for a magical node that converts my rotation entirely in the way I want it to

Thanks!

1 Like

Meh… can’t use look at anymore.

I’m sure you can see, that turning a wheel ( even in real life ), is a case of adding or subtracting rotation.

Why are you using look at?

1 Like

Because I already had the relative position from the controller to the base of the wheel from a Project to Plane. And figured I could just use this position to rotate the wheel.
I can’t currently think of any better ways of implementing this.
I get that I can rotate it like this using addition and subtraction, but not without overcomplicating the calculation i’d think? I may be wrong here…

1 Like

You’re locked into the ‘set’ way of thinking here

So what if the wheel is already in a position, and you know what it is. You can still add relative rotation to it without knowing about that.

Do you see what I mean?

( could be I’m missing something, but I don’t think so ).

2 Likes

Sorry, I might be dumb and stupid. But I haven’t been able to find a better way to rotate it using add or subtract relative rotation. My results either has the wheel spinning too quickly/slowly or doesn’t feel like it’s accurately following my hand. The feel is very important.

I’ve been unable to upload the gif to the original post for some reason, but the hands in VR are moving in a circular motion and has the wheel following this. I Don’t want an inaccurate VR wheel here like most do, where you move the hand vertically or horizontally to turn the wheel based on the amount you moved it in these axes.

Maybe I’m just locked into this way of thinking, but this works, and it feels great in VR.
I’d like to continue using the same method of rotating the wheel, just converting the angles away from being locked at 180 and swapping over to -180.

I’m sure Im either being slow here, or not properly explaining the issue to you, but if you have an example of moving a wheel in VR using add / subtract ( or using add / subtract in general to set a wheels exact rotation based on degrees above 180 ) I’d love to take a look at it and learn how this is done.

Idk why the gif appears too big to upload… considering its well below 100MB…
I’ve uploaded it to google drive instead and linked it here and in the original post, in the event it makes things clearer. Thanks.

1 Like

Hey

100MB way too big ;), more like 10-15 is ok.

Let’s say the hand in at the top of the wheel, and you move it to 9 o’clock. You know you have to subtract 90 from the wheel’s position.

If you use the relative method, you have to let go of every knowing what position it’s in, that’s how it works.

Also, use rinterp to move the wheel, I think this will give you a realistic feel. I’ll make a version using the mouse and upload it…

It’s either this or Quaternions, which I am free to admit I know nothing about ( apart from you don’t get this problem ).

2 Likes

Yup, give up.

It’s a mess.

I think you might go one of 2 ways.

1. Limit rotation to slightly less than ± 180

2. Use Quats

2 Likes

Ok, after several brain seizures, I remember that what I meant to say was ( plane flys over with banner trailing behind it ):

O-M-G.

So I have ‘steering wheel’

There is actually a large torus hidden which I am line tracing to

It’s up to you how you do the translation between the ‘hand’ and the object, but I’m line tracing from the camera.

Basically the idea is, keep a record of this trace point and the previous one, and figure out the angle between them, and if we’re going clockwise or anti-clockwise.

So, on tick we have

this is me finding the current hit point and then calculating the previous location + and - 20 degrees. Then I

Figure out the spin ( wait for it ), and apply it to the wheel, with ADD LOCAL ROTATION, which works. Add relative rotation does NOT.

Find spin direction, is just ( store the variables locally so I don’t have wires everywhere )

and figure out which direction I’m going in, from the angle between where I am now and the + and - points

The angle between two vectors is just

Notice ( in the main code ) I subtracted the actor location from the location, otherwise rotating it around the pivot point makes no sense.

And BOOM:

3 Likes

Thank you so much for the time and effort put into this. This worked flawlessly!
Now I just have to add the Delta Angles together to get the total amount rotated!

Brilliant!

( One thing to add, is that this, for me, also worked with AddRelativeRotation, Idk why it wouldn’t for you, or what the difference between the two nodes are )

Thanks again!

PS: You can avoid the ‘adding and subtracting’ rotation calculation by using the right vector to figure out the direction, I figured out later.

1 Like