FishGibble Breakdown Part 2 – Interp Movers

The InterpActors allow for any mesh, or hierarchy of meshes to have local transformations ( translation, rotation and scale ) interpolated over time, at different, or a constant speed, and by cycling through, or ping-ponging between the beginning and end transforms. It may also be setup to act and interpolate with triggers for opening, and auto closing after a set time using these blueprints.

The DirectMoveActors can move any character, including AI in a specific direction, at a specific speed, and when combined, will increase the movement speed as they move through the objects based on triggers / overlap spheres.

*Note all level and meshes are for testing

Interpolation Actors

Interpolation actors uses a per-instance configurable array of local transformations that it will cycle through based on various parameters. This is useful for creating things like doors, moving platforms as they can have collision set on them, launchers *that launch stuff, moving physics blockers, hazardous areas etc..

This untextured block has rotation, translation and non-uniform scaling interpolation done on it over a relatively slow period of time.

 

Video Of BreakDown here:

 

 

The FGInterpResetActorBP blueprint itself derives from FishGibbleInterpActor and has no special or any default values set, they are meant to be set per-instance, as they are placed in the world.

 

 

The FGRotatorBP can perform a constant rotation around any given local axis, at a specific but constant speed.

 

 

 

The FGRotatorBP itself has no default values set, and requires them to be entered on a per-instance basis, as they are placed in the level.

 

 

All of the InterpActor blueprints derive from the FishGibbleInterpActor c++ class.

Itself derives from the ACullableActor class.

 

 

The CullableActor is responsible for providing configurable cullable behaviour, meaning events will be fired, based on distance from the camera on top of Unreal ‘Max Draw Distance’ settings for meshes. Which is very useful for ignoring physics checks, hiding parts of the mesh etc.. on top of normal LOD and Unreal ‘Max Draw Distance’ behvaiour, this helps create very customizable performance objects, where many may be placed in a level and  still function adequately.

 

 

 

The cullable actor calls a CheckCull every configurable few seconds, and then invokes the derived C++, and blueprint event hooks, to give the code, and the blueprints a chance to do any optimization, or whatever it needs to do, based on camera distance.

 

 

The FishGibbleInterpActor uses an array of local transformations to interpolate between, but in-game, they need to use world space transformations to interpolate between, thus in the BeginPlay function, it will multiply each interpolation matrix by the actor/blueprint’s world matrix, thereby putting it in the same space as the actor itself.

 

Then from the tick function, if the blueprint has constant rotation set, it will rotate using  AddActorLocalRotation with local axis, where X = Pitch, Y = Yaw and Z = Roll, at the first speed specified in the InterpSpeed list, which is just a list of floats.

It will also interpolate between the world space matrices using the ‘TransformInterpTo‘ custom function, which interpolates between transforms using a speed.

 

 

The TransformInterpTo function is a custom C++ function that I wrote that calculates an ‘Alpha’ ( between 0 and 1 ) value, by clamping the DeltaSeconds ( the time in between frames, as this is called every tick ) multiplied by the interpolation speed, and then uses that to call the TransformLerp function, which calls the Unreal function Matrix.Blend function, passing the alpha value calculated previously.

This has the effect that a new matrix will be calculated by blending 2 matrices using an alpha value, where the alpha value will slowly increase or decrease between 0 and 1, smoothly/linearly interpolating between the matrix translation, rotation and scale.

The identity matrix is normally used as the initial/first transform in the interp list, so that the object can sweep back to it’s original position, orientation and scale, but this is not required, it can have any starting, in between and ending transforms. Using the identity matrix ( where the translation and rotation is 0, scale is uniform 1 ) in any of the interp slots, will cause the object to return to it’s transform that was used to place it in the world.

 

 

 

Direct Move Actors

These actors are used to move a character in a specific direction, at a specific speed, the speed is applied as a physics impulse, and is once off, fire and forget, when combining movers together, the speed will compound over time, and the actor moves quickly through the movers.

 

 

 

Movers have per-instance settings that allow them to move actors in different directions, while using the same blueprint. In this test level’s case, glass tubes have been created, to move the character from one area of the tank, to another that is otherwise not accessible. Moving an actor using physics will allow it to follow or slide along it’s collision primitives, and because glass tubes, that are curved, have curved collision on them, the character will move and slide through the tube, changing direction because of the collision, and not because of the mover or impulse itself.

 

 

The GlassTubeMove blueprint includes an arrow for identifying which orientation the impulse will occur in, and by setting the per-instance orientation of the overlap sphere, it will change the direction of the physics impulse.

 

The Movers all derive from the DirectMoveActor C++ class, and the class itself has very few properties, the most notable are the ForceToMoveBy scalar float value.

 

The DirectMoveActor uses an overlap sphere, with overlap triggers enabled, to determine when to apply the impulse to the actor that it is overlapping with.

The character is also rotated towards the movement of the impulse, but this is ignored when the character is being controlled by the controller, as the rotation of the player is set using the controller yaw and pitch.