- Home /
How do I rotate the propellers on this drone?
Hello! I'm creating a game where the player can fly a drone around. I made an empty game object called "Drone" and placed all of the pieces together to make a body with wings and feet, and then made all the pieces children of the empty game object. I did some scripting and now I am able to move the drone in all directions and fly around.
So, here's where I'm running into an issue; I made a bunch of small propeller objects and I'd like to attach them to the wings so that when the player presses the spacebar to move up, the propellers spin (separately from the rest of the drone). I made the propellers and made them children of the empty Drone object, and added a script (only to the propeller "children") so they would rotate when the spacebar was pressed.
When I do this, however, it doesn't really work. It sort of made the entire drone rotate. This isn't what I want at all. Can anyone help me out? I've been trying to use joints but they just make the propellers fall off the drone or make the drone get stuck in the ground.
Answer by whydoidoit · Apr 02, 2014 at 04:05 AM
You need another game object to be the propeller's holder. It needs to be positioned correctly and then the propeller is a child of it at local position 0,0,0. You can now rotate the propeller around it's local y axis to make it spin.
I wouldn't bother with a joint to make it break off, unless you really want a particular force level to make that happen. If you want the propeller to break due to some impact then give it a rigidbody set to isKinematic = true. When it collides with something you set the parent of the propeller to null and set isKinematic = false - perhaps providing it with some force based on it's current rotation (set its angular velocity to its spin rate and its velocity to the velocity of the drone).
Your answer
Follow this Question
Related Questions
How to rotate object about 2 axes (vertical y and depth z) using configurable joint. 0 Answers
Returning a rigidbody back to its original x and z rotations through physics forces. 2 Answers
Creating a joint based stab motion(going nuts) 1 Answer
relative velocity of rigidbody according to rotation... 1 Answer
Make object tip over 1 Answer