The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
How do i make something continuously spin and have a bobbing or hovering movement?
I created a pedestal for the electric motor of my vehicle that is supposed to showcase the motor rotating along an axis in a hovering container like in the picture.
Best Answer
-
OptionsHoloSheep mod
@WEDimagineer you need to put an empty game object as a parent and use the parent kind of like a wrapper.
You can adjust the child's relative position (relative to the parent) and then rotate the parent game object.
Since the parent is an empty game object its origin will be at it 0, 0, 0 position. By adjusting the child's position it just moves relative to its parent, so you move it to a place where its desired origin overlaps the parents 0, 0, 0 position. Then when you rotate the parent, the child will go with it and it will appear to rotate from the desired origin (as long as you place the child at the correct offset position.
This post with pictures might help explain.
Windows Holographic User Group Redmond
WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
WinHUGR YouTube Channel -- live streamed meetings5
Answers
@WEDimagineer
To rotate a gameobject you can use code like:
myGameObject.transform.localRotation = Quaternion.Euler(0, rotAngle, 0);
or
myGameObject.transform.Rotate(Vector3.up, rotSpeed * Time.deltaTime);
in the Update routine of a script attached to the object hierarchy.
HTH.
Windows Holographic User Group Redmond
WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
WinHUGR YouTube Channel -- live streamed meetings
@HoloSheep
is there a way to rotate at the center instead of the origin? I know I asked this already, but isn't there a way to rotate it along the axis of a different part, like the cylinder below it?
@WEDimagineer you need to put an empty game object as a parent and use the parent kind of like a wrapper.
You can adjust the child's relative position (relative to the parent) and then rotate the parent game object.
Since the parent is an empty game object its origin will be at it 0, 0, 0 position. By adjusting the child's position it just moves relative to its parent, so you move it to a place where its desired origin overlaps the parents 0, 0, 0 position. Then when you rotate the parent, the child will go with it and it will appear to rotate from the desired origin (as long as you place the child at the correct offset position.
This post with pictures might help explain.
Windows Holographic User Group Redmond
WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
WinHUGR YouTube Channel -- live streamed meetings