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
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.
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);
Transform.RotateAround