When you say “I have a euler angle of another gameObject that I want to move the target gameObject in” do you mean that you want to move your game object towards the other gameobject? If so you don’t want a rotation you want a direction.
Gives you a vector3 pointing in the direction from the 1st gameobject to the 2nd.
Currentobject.transform.position += Direction * Time.deltaTime * MovementSpeed
Will move the objects location in that direction without consideration for forces and physics.
If you want forces and physics then apply the movement through whatever rigid body or controller you have on the object.
i.e if you’re just using a rigidbody:
I want to move the target game object in the same direction the other gameobject is facing, so if the other game object is at 90 degrees, I want to move the target gameobject to the right, without rotating it
Ah, you didn’t mention you were talking about a Vive/VR controller, afraid i can’t help you much with specifics, no experience with vive/VR it and don’t have the stuff installed to poke around with it.
All gameobjects have a standard transform which includes a .forward, the standard transform also doesn’t have .rot.eulerAnglers (it’s just .eulerAngles). Suspecting that SteamVR_Controller.Device is not a unity gameobject/component and is using it’s own custom transform class. Afraid i can’t help you with whether there’s a normal way of getting a forward direction from your vive controller.
But it is possible to calculate a direction using eulerangles. Essentially you create a Quaternion rotation, and then use it to multiply some default base direction (Which i can’t tell you what is for Vive but is most likely vector3.Forward) in order to rotate it to point in the final direction
Quaternion Rotation = Quaternion.Euler(eulerAngles);
Vector3 Direction = Rotation * Vector3.forward;
Beyond that, i’d just amend the thread title to be a little more descriptive that you’re trying to get the forward direction from a vive controller so you can try and get help from someone more knowledgeable about vive
This has me half way there. if I add 270 degrees to the angle, and hold the tip of the controller pointing in the direction I want to travel, I move in that direction now. With the vive controller oriented like this ( touchpad facing straight up):
x axis - tip up and down
y axis - controls direction of movement, where you point the handle, you go
z axis - controller roll
I need to change the whole transform about 90 degrees.
I want to stick the handle into the back of my belt, so movement will still happen in the direction the handle is pointing at, but the handle won’t be pointing straight at the object. I can’t just rotate a fixed value on the rotation variable, because then it sends the object into the air. the whole orientation of the controller needs adjusted for the calculation, which I am not sure what to use to do.