Unity Tools Scripts

From BallisticNG Wiki
Jump to: navigation, search

This article is a stub. You can help BallisticNG Wiki by expanding it.

Ballistic Mesh Collider[edit | edit source]

Ballistic Mesh Collider is a script that contains a dropdown of options for different collision types.

Ballistic mesh collider dropdown

Keep in mind that all collisions will be mesh colliders, as the name suggests. Due to the nature of BallisticNG's physics it is not recommended you throw this on everything, only certain set pieces that should obviously be collidable (such as scenery walls).

Track Floor
  • Attach this to your track floor and nothing else!
  • This is used as a flag for the lightmapper to indicate this is a part of the track.
  • If you use the Track Wizard then this has already been done for you.
Scenery Floor
  • Attach this to any meshes you want players to be able to hover over.
  • Keep in mind that the game will have to copy all of the mesh elements to work with for both hovering and rotation, this will only happen for every time you switch between the track floor and different scenery floors but it could cause hiccups on complex meshes!
Track Wall
  • Attach this to your track wall and nothing else!
  • This is used as a flag for the lightmapper to indicate this is a part of the track. If you use the Track Wizard then this has already been done for you.
Scenery Wall
  • Attach this to any meshes you want players to collide with.
  • This will make the mesh that this is attached to, behave similar to track walls.
  • While "scenery walls" affect ship trajectory on collision, they don't affect ship speed or acceleration. Additionally, no "wall collision" sound effect is played.

Zone Disable[edit | edit source]

Attach this script to any objects you want to be disabled in zone mode. Attach this to your SkyDome and cross-plane vegetation.

Render Targets[edit | edit source]

Render Targets allow you to use a camera to render what it can see onto a material. Render Targets are always rendered at 128x128. There are two components needed to make a render target work.

Render Target Display[edit | edit source]

This is what updates a material, attach this to a mesh renderer. This will create an instance of the material in the mesh renderer.

The render target display waits a frame until it configures the material, this gives it time for any material overrides to take place.

Texture Names - This is an array of the names of the texture in the shader to update. The default names for all BallisticNG materials are "_MainTex" and "_Illum".

Target Camera - This is a reference to the Render Target Camera which will be used to render.

Render Target Camera[edit | edit source]

This is what does the rendering. Attach this to an empty gameobject.

The camera will be created automatically with all of the settings it needs.

Framerate - How fast the camera renders (FPS). The default value is 24, it's recommended you keep this value low as it will save your performance.

Field of View - The field of the view for the camera. This is updated every time the camera renders so you can update it through a script if you want too.

Use Main Camera - Show the players display instead of creating an individual camera.

Performance[edit | edit source]

Render targets should be used sparingly, especially if you use higher framerates. Cameras are only rendered at the set framerate.

Every time the camera renders it has to copy the pixel data into a texture and upload the changes to the GPU. The impact of this is dampened by how small the texture is, but if you add loads of these up then you will quickly find yourself dropping frames very quickly. The memory footprint of this is also very small given the texture size, but again, building them up will quickly increase the memory footprint.

Respawn Zone[edit | edit source]

Respawn Zones are trigger volumes that force the ship to respawn. Their use cases are for blocking off unintended track skips and getting the player back onto the track quickly if they go out of bounds.

Note: you do not need to surround your entire track in respawn zones - the game has a system in place that keeps track of where the player is in relation to the track and can respawn them automatically if need be.

To create a respawn zone, go to "Component > BallisticNG > Behaviour > Respawn Zone" on Unity's title bar with an object selected, to attach the "Mod Respawn Zone" script. All you need to do now is position, rotate and scale it however you want. The volume of the zone is visualized.

Jump Zone[edit | edit source]

Overview[edit | edit source]

  • Jump zones are trigger volumes that push ships around and increase acceleration.
  • These allow you to create large jumps that ships can still fly over.
  • These are just a script, attach them to any empty GameObject to set them up.
  • Once you attach this script to an object, you can NOT scale the object using the normal Unity textboxes. You can only scale by dragging the little blue squares on each side.

Configurable values[edit | edit source]

Jump zone script example

Toxic/Apex/Halberd/Spectre/Zen You can configure the push speed and acceleration per speed class.
Push Speed How fast to push the ship. This is a constant speed.
Acceleration Multiplier How much to multiply the ships acceleration by when inside the jump zone.

0 means that ship acceleration remains unaffected.

Example[edit | edit source]

You can click the thumbnails below to view the full-sized image.

The red handle indicates the vertical angle of the push.

The semi-transparent colored circle (shown below) can be ignored. The "handle" is what you want to focus on.

Jumpzone example red handle

The green handle indicates the horizontal angle of the push.

Jumpzone example green handle

The game uses both green & red "angles" to determine the actual push angle.

The screenshot below shows a full example.

Jumpzone example

Lightmapping Options[edit | edit source]

This script allows you to control how the Vertex Lightmapper treats an object.

Ignore Lightmapper This object will not be affected by lightmapping.

If you've already run the lightmapper before adding this script, you'll also need to manually remove the "Vlm Data (Script)" component from the object.

Check this option for skydomes!

Allow Directional Shadows BallisticNG usually bakes directional light shadows up. If this is ticked then directional lights can cast shadows in the direction they are facing.

Uncheck this option for skydomes!

Cast Shadows If ticked then this object can cast shadows onto other objects.

Uncheck this option for skydomes!

Receive Shadows If ticked then this object can receive shadows from other objects.

Uncheck this option for skydomes!

Instance Mesh <todo>

Ballistic Material[edit | edit source]

See Unity Tools Materials

Next up: Animation System