- Home /
in game pivot point not be the center of the object
hello everyone, i am trying to make a game where you can, in a minecraft style, build vehicles, weapons, bases, etc. i got down the entire ship building, now i need it to make it usefull. the game will use engine blocks and gyroscope blocks to handle the thrusting and the turning. so my problem is how do i make the entire ship rotate using the gyroscope block as a pivot point. i do not want to deal with playing with parenting. i don't have any idea on how to do this. if some one knows of a way pls tell me.
p.s. dont write code. i want to have this as a learning expeerience, and i dont want you to take to much truble, so pls just ideas and snippets.
kind regards, thenachotech
btw the blocks are parented on an empty game object when placed. so there will be a lot of objects in a single vehicle that will have to turn.
Answer by Dblfstr · Feb 04, 2014 at 09:44 PM
I think you might want to look into Transform.RotateAround
You can rotate the ship in any direction around a point you choose, that point would be where your gyroBlock is. Then you choose the angle of rotation.
Transform.RotateAround(rotate on the y axis, of the gyroBlock, 90 degrees);
Answer by OtsegoDoom · Feb 04, 2014 at 09:18 PM
I'm not sure why you want to avoid parenting anything since that really would be the easiest way to accomplish what you're after.
I can sort of understand why you wouldn't want to parent anything to the gyro block if it is treated like the rest of your blocks, but how bout this:
Gyro block gets placed
Gyro block creates empty game object (we'll call this the GyroParent) with the exact same position and rotation as itself
Parent your empty game object (the one with all the blocks as children) to your new GyroParent
Either that or just use the transform of your gyro block for all rotation code.
thank you for your answer.the reason i do not want to use parents is because i have a lot of parenting and un-parenting stuff to achieve other mechanics, the more i add the more complex and likely to fail. i realy thank you for your time and this answer has been truely usefull.
There is a lil box on the left side of the screen that says "Centre" change it to "Pivot" I was dealing with door pivots last night, this small feature saved a lot of time
Your answer
![](https://koobas.hobune.stream/wayback/20220613132545im_/https://answers.unity.com/themes/thub/images/avi.jpg)