Scripts

Spaghettification Controller

As described before, setting the pull curve of the Spaghettification Shader can require a lot of thinking. Depending on the direction you are coming from you would need to manipulate the X, Y and Z axis of the pull curve in different ways. Let's say we ignore the Y axis, so we don't really care if we are coming from upwards or from downwards. The only thing that is interesting to us is the X and Z axis to create a clockwise or counterclockwise pull in curve.

Instead of calculating the proper values for the shader, just attach the script to the GameObjects with Spaghettification Shader Materials and specify the following properties:

Curve Strength

Just specify the strength of the curve. The script will do the calculations based on the object and target positions and update the X and Z values of the shader pull curve

Curve direction

Clockwise or Counterclockwise

Target Holder

The SpaghettificationController works in combination with the TargetHolder script which is directly attached to the Black Hole GameObject. The holder has info of the black hole position, the pull radius and the threshold. The SpaghettificationController will fetch this info directly from the TargetHolder, so you do not need to specify it for every object that has the SpaghettificationController attached!

Move Towards target

This script simply moves the gameObject where it is attached to, to the target specified in the TargetHolder.

You can define the delay and the move duration.

Last updated