Hi, I'm currently creating a helicopter mod. I want this to look nice, so it should have a spinning rotor.
However it seems that animations in car entitys are hardcoded to the forward direction. I understand why that makes sense for cars but it really sucks for my purposes.
In general it seems that entity animations are tied directly to ingame behaviour, and I can't find a way to get script control over them. I mean not only has the rotor animation to be independent of the body animation/orientation, I also need to be able to stop it and set its speed...
So is there a way to do this?
To make this post more exciting, here is a screenshot of how it looks so far.
Separate animation for helicopter blades
Re: Separate animation for helicopter blades
The rotor is another car!
Re: Separate animation for helicopter blades
Yeah, I found out about that trick by looking at this mod
viewtopic.php?f=14&t=12747
Gosh that sucks. I would have thought an excellent game like factorio would have an excellent modding system as well but eh.
viewtopic.php?f=14&t=12747
Gosh that sucks. I would have thought an excellent game like factorio would have an excellent modding system as well but eh.
Re: Separate animation for helicopter blades
Mod released, check it out: https://mods.factorio.com/mods/kumpu/Helicopters
-
- Filter Inserter
- Posts: 841
- Joined: Mon Sep 14, 2015 7:40 am
- Contact:
Re: Separate animation for helicopter blades
Whew, that's quite a lot of code shenanigans just to get a smartly animated rotor!
Seems you've made it work like you wanted, kudos.
Seems you've made it work like you wanted, kudos.
Re: Separate animation for helicopter blades
Thanks! Oh man, the entire code is a shenanigan. The rotor is another car but for some reason vehicle orientation does not directly translate to the displayed frame. Looks like they have some kind of easing applied, as you can see here in this image.
(x axis is what frame should be displayed - meaning orientation = x/64, since I use 64 frames. The line in blue shows whats drawn instead).
So I had to translate those values and the entire process just sucked. I really hope they will improve their API.
Looks pretty funny on the map tho
(x axis is what frame should be displayed - meaning orientation = x/64, since I use 64 frames. The line in blue shows whats drawn instead).
So I had to translate those values and the entire process just sucked. I really hope they will improve their API.
Looks pretty funny on the map tho