I’m currently working on implementing some advanced animation features to the game I’m making and I’ve kind of hit a wall for a particular animation I want to add.
Basically I’m trying to add an animation to a ship steering wheel and a third person character which need to sync up. I’ve tried many different approaches I came up with myself but none of those seem to do what I want.
I’m wondering if anyone out there has ever done something like this and if so what is the best approach to do this?
Here is a gyazo of what I’ve managed to make myself, pretty horrible and it doesn’t work well both ways.
Any kind of help would be VERY appreciated. Whatever info or tips you can share on this subject would help a lot!
I’ve looked all over the internet to find even the slightest bit of tips on how to even begin with something this complex, but sadly nothing can be find.
As an example, the game Assassin Creed Black Flag has a similar system
How do you have the example set up? It looks like it’s working and just needs polish. More or less the Black Flag example is a simple A-B sync so if your already doing that your heading in the right direction.
Well, the gyazo may look like it’s working. But it’s kind of not. lol
The system used in the gyazo example has the wheel as a mesh being rotated at an precise amount (which I pretty much eyeballed) so it syncs (kind of) with the animation of the character.
I’ve actually improved it a bit by using a different approach. Now the wheel also has a bone and is animated together with the character, meaning that the hands are always perfect on the handles. But there are still a couple of issues. And I’m still not sure if this is the best way.
Here is how I’ve got it set up atm:
The character and steering wheel are animated together in the same 3dsmax file. So this means the animation is perfectly synced between the steering wheel and character. What happens right now is that the steering wheel and character animation are triggered at the same time. Which does exactly a 90 degree turn. So when the player presses for example right, the animation always plays at least one full 90 degree turn. Why? Because it’s currently the only way I can make it work without having the wheel snap back in the middle of a cycle (90 degree turn). Well it still snaps back to it’s original idle position which is 0 degrees but it only happens when the cycle is done so it’s “less noticeable” (not really). When the wheel snaps back it happens instantly making it so that it seems as if the wheel just stays at it’s 90 degree position when in fact the wheel has snapped back to 0 degrees (at least that’s the theory behind it, but in reality it doesn’t work as nice as I think it should). This makes it so that details on the wheel such as scratches and chamfers also snap back. Now thing is I could kind of fake my way around this issue and just make the steering wheel even all over, so it doesn’t have any jump out details that make it look obvious that it snaps back. But there are however a bunch of other issues still. One of them being that the snapping back causes a very visible jitter in the mesh which looks quite bad. The reason for that is probably because the way I snap the wheel back is by checking it’s current remaining animation time and when it’s less than 0.1% it should revert back to it’s idle position, but because 0.1% isn’t perfect the snapping / jitter is noticeable.
But I don’t know, my head is kind of melting atm from trying to make this work. I’ll try again tomorrow and see how it goes from there. I think I’m somehow on the right track.
Yeah your on the right track to create whats usually referred to as A-B Sync. The only step I don’t see is you will need to export the animation as a “export by selection” to FBX
A- in this case is the wheel determines the world origin of the object and B- ,your character or actor,uses A to determine it’s position relative to A as the off set in world space. The root of the object is generally used for this purpose so if we move the wheel to XYZ 100,100,300 all we could have to do is snap the root of B to A and the sync will match up.
The Matinee example shows this nicely as you can drag and drop the five animations into the scene and snap them to 0 0 0 and the animations will sync.
How to go about turning the wheel based on a A-B Sync would be more about the math to turn the wheel a full 360 to the left and right and then index the output value as to the current position, rotation, of the wheel relative to the B animations of the actor.
As luck would have it Epic has added a recent feature where you can index the animation frame number rather than messing around with blend spaces or state machines.
If you drag and drop a animation take into your graph you can select it and right click and “convert to single frame animation”. You can then control the full 360 turn of the wheel, left or right, by just tracking the current index of the animation at the given point. To add polish you could key frame a idle pose every 30 frames or so so you can rinterp to the closest idle state and avoid mid air hanging of the hands.
I’m currently playing around with the “convert to single frame animation” but for some reason when I enter in a value of 1 in explicit time the wheel only does like a 30 degree turn instead of a 90 degree (which is the full exported animation). AS far as my understanding goes, shouldn’t the animation play one 90 degree turn when the time value is set to 1? Why isn’t it playing the full animation? o_O
Also when I set the value higher than 1, for example 4 it plays the 30 degree animation 4 times faster. Which kind of makes sense as 1 * 4 is 4 times faster. Yet I don’t understand why it doesn’t play the full animation.
Ok, nevermind I found out why.
1 isn’t the full animation. When you go into the animation itself and play around with the slider on the bottom to go through it you can see the actual time, which is the number you need to use. The number in my case was 3.3, not 1.
Ok I think I found a way to do this. But I have no idea how to achieve it inside of Unreal Animation blueprint.
Basically my idea is:
Import the wheel animation as a 360 full turn
When player turns right -> Turn the wheel 90 degrees
When player turn left -> Reverse turn the wheel 90 degrees
However long the player presses left or right the wheel will always do at least 90 degrees either left or right.
This is where it gets difficult. How can I make up my animation blueprint so that the wheel always interps to the 90 degree position it’s closest to after one turn cycle. There are 4 possible position for the wheel to go to after a cycle: 0 degrees, 90 degrees, 180 degrees and 270 degrees.
Ok, so how can I somehow implement this? My first thought was to check the current wheel animation time (between 0 and 360 degrees from frame 0 to frame 400, 100 frames is one 90 degree turn) But the problem is that I can’t save any variables inside the animation blueprint, so I can’t pass the wheel’s animation time from the turning state over to the idle state.
The only other way I can think of but seems insanely complex is have an external int variable which cycles between 0, 1, 2 and 3 and then from inside my steering wheel blueprint cycle through this variable and then somehow make the wheel turn to the degree that is defined by the int variabe (0=0, 1=90, 2=180 and 3=270). But this isn’t going to work either. Because this would mean that I use the “convert to sinfle frame animation” setting which makes the wheel turn at a certain interpolation speed set in the transition state which doesn’t sync with the character’s animation. Well, thinking of that right now I could probably set that transition time to 3.3 which is the exact time it takes for one cycle (90 degrees). The other thing about this method is that how can I loop it when the player keeps turning the wheel. Like I said before, it’s impossible to set any variables inside the anim blueprint and I can’t keep track of the time the current turning animation is in so there is simply no way (to my knowledge) to check if a cycle has passed and a new one should begin).
It would be pretty easy if I could just keep track of the current wheel’s turning animation time and whenever the player stops turning check said time against one of 4 possible times for each degree and then interpolate to the one it’s closest to, but sadly this doesn’t seem possible inside of the animation blueprint.
Ok, I got it almost working perfect. I’ve now changed it so that the animation is just completely using the key frames as you suggested. I should have listened to you, you were right. It works. There is only one thing left I need to do to polish it. All I still need to add is a way that the currentframe time always keeps adding or subtracting until it reaches a “waypoint” which is 1 of 4 possible positions (0, 90, 180 and 270 degrees) or in frametime (0, 3.33, 6.66 and 10). How could I do this? This is more a blueprint question rather than an animation one though.
Ive tried using float in range node, a boolean system, compare int, … Nothing seems to work as intended. it’s like sometimes it skips over the comparison / waypoint most likely because framerate is inconsistent and sometimes there are no frames with the desired float value.
hi i am also making character wheel rotating animation but im sturggling to make it can u send me your animations of wheel rotating . it would be very much helpfull to me