i’m making a plane flying in unity and would like to have the propeller spin. Can that be done in Unity? How is the best way?
Yes it can be done and there isn’t specifically a best way. Your options:
-
Create a simple external animation (keyframe) in which the propeller rotates. Inside of Unity you set that animation to loop and call play on it once and away you go.
-
Create a simple script in Unity that uses a simple coroutine based animation function to rotate the propeller, it would be trivial to then adjust your rotation speed based on things like a throttle setting.
Note also that a lot of games and animations switch the propeller at a trigger speed to a spinning disc with a suitable texture to properly simulate the look of a fast spinning prop-rotor-etc.
-Jeremy
Hey there,
A while ago I wrote a script that would take care of continuous movements and rotations for me. It’s attached to my post. Check it out, it might help you. If you have any questions, don’t hesitate to contact me
141473–5171–$moverscript_193.js (2.31 KB)
I used the script from Voxelboy. After playing with the script it works great. I’m really a modeler so scripting (for me) has been very easy actionscripting in the past.
i do have one problem though. i have the propeller as a child to the plane body, but when you go forward the propeller (spinning) stays where it is. how do I adjust the script where it’ll follow the plane body?
141504–5176–$baron_500.zip (716 KB)
Make sure the moveTime variable is 0.0, otherwise it’ll want to move the object and that’ll cause the kind of behavior you’re seeing. Since you only want rotation, you shouldn’t need the move functionality of the script anyways so it shouldn’t be a problem I think. Let me know if that doesn’t work.
now that its moving forward… how do you script the dive and climb and side to side movement?