All Projects → Jay2645 → Buoyancysystem

Jay2645 / Buoyancysystem

Licence: mit
A system for buoyancy and boat physics in Unreal Engine 4.

Projects that are alternatives of or similar to Buoyancysystem

Unreal Polygonal Map Gen
An Unreal Engine 4 implementation of the Polygonal Map Generator for generating islands found at http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/
Stars: ✭ 229 (+163.22%)
Mutual labels:  game, unreal-engine, ue4, unreal-engine-4, unrealengine
Rts Community Project
Lets build an RTS Game with Unreal Engine 4!
Stars: ✭ 183 (+110.34%)
Mutual labels:  unreal-engine, ue4, unreal-engine-4, unrealengine
Ue4 Style Guide
An attempt to make Unreal Engine 4 projects more consistent
Stars: ✭ 2,656 (+2952.87%)
Mutual labels:  unreal-engine, ue4, unreal-engine-4, unrealengine
Flopnite Ue4
A remake of the popular battle royale game, Fortnite, made in Unreal Engine 4 and integrated with Amazon GameLift
Stars: ✭ 250 (+187.36%)
Mutual labels:  game, unreal-engine, ue4, unreal-engine-4
Psrealvehicle
Plugin for Unreal Engine 4 with simple force-driven vehicle simulation
Stars: ✭ 92 (+5.75%)
Mutual labels:  unreal-engine, ue4, unreal-engine-4, physics
Actionrpggame
Unreal Engine 4 Action RPG type game starter kit.
Stars: ✭ 773 (+788.51%)
Mutual labels:  unreal-engine, ue4, unreal-engine-4, unrealengine
Ue4 Binary Builder
An application designed to create installed Unreal Engine builds (aka Rocket builds) from Unreal Engine GitHub source.
Stars: ✭ 292 (+235.63%)
Mutual labels:  unreal-engine, ue4, unreal-engine-4, unrealengine
Ue4 Gitignore
A git setup example with git-lfs for Unreal Engine 4 projects.
Stars: ✭ 150 (+72.41%)
Mutual labels:  unreal-engine, ue4, unreal-engine-4, unrealengine
DataConfig
Unreal Engine JSON/MsgPack serialization framework
Stars: ✭ 81 (-6.9%)
Mutual labels:  unrealengine, unreal-engine, ue4, unreal-engine-4
RuntimeBPs
This project allows for visual scripting in UE4 similar to Blueprints, but at runtime. The way this is set up does not make use of any UE4 boilerplate and could with a few adjustments be used in another engine.
Stars: ✭ 77 (-11.49%)
Mutual labels:  unrealengine, unreal-engine, ue4, unreal-engine-4
gamedevguide
Game Development & Unreal Engine Programming Guide
Stars: ✭ 314 (+260.92%)
Mutual labels:  unrealengine, unreal-engine, ue4, unreal-engine-4
ue5-style-guide
An attempt to make Unreal Engine 4 projects more consistent
Stars: ✭ 2,892 (+3224.14%)
Mutual labels:  unrealengine, unreal-engine, ue4, unreal-engine-4
Unreal-Binary-Builder
An application designed to create installed Unreal Engine builds (aka Rocket builds) from Unreal Engine GitHub source.
Stars: ✭ 554 (+536.78%)
Mutual labels:  unrealengine, unreal-engine, ue4, unreal-engine-4
Unreal-Development-Guides-and-Tips
High-level concept explanations, detailed tutorials, performance considerations, shortcuts and other useful content that aims to improve your Unreal Engine 4 development journey.
Stars: ✭ 118 (+35.63%)
Mutual labels:  unrealengine, unreal-engine, ue4, unreal-engine-4
Unrealcpp
Unreal Engine 4 C++ examples
Stars: ✭ 490 (+463.22%)
Mutual labels:  unreal-engine, ue4, unreal-engine-4, unrealengine
Pbcharactermovement
HL2-style, classic FPS movement for Unreal Engine 4 implemented in C++
Stars: ✭ 582 (+568.97%)
Mutual labels:  unreal-engine, ue4, unreal-engine-4
UE4-Plugin-OffAxis
This plugin provides a fishtank-VR via a so-called OffAxisProjection by modifying the projection matrix using a custom ULocalPlayer
Stars: ✭ 59 (-32.18%)
Mutual labels:  unrealengine, unreal-engine, unreal-engine-4
Dungeontemplatelibrary
🌏: Dungeon free resources (terrain & roguelike generation)
Stars: ✭ 595 (+583.91%)
Mutual labels:  unreal-engine, ue4, unreal-engine-4
libprotobuf ue4
libprotobuf for Unreal Engine 4
Stars: ✭ 81 (-6.9%)
Mutual labels:  unreal-engine, ue4, unreal-engine-4
Blui
Rich HTML UI engine for UE4
Stars: ✭ 753 (+765.52%)
Mutual labels:  game, unreal-engine, ue4

BuoyancySystem

A system for buoyancy and boat physics in Unreal Engine 4.

There are a few main parts to this plugin:

  • BuoyantComponent: This is an ActorComponent which can be added to anything which can float. This uses spheres to test for buoyancy -- faster than calculating how much of the object is underwater, but also less accurate and requires the user to manually specify where the spheres should be placed and how large they should be. There are options for setting the Displacement Ratio (how much force is applied upwards to provide buoyancy) and the Mass Multiplier (how much the force of gravity is multiplied by when the BuoyantComponent is falling downwards). You can also set points which will cause the object to lose buoyancy if any of the points goes underwater -- this can model, for example, the top of a boat going a little too low, causing water to rush in and sink the boat.

  • BuoyancyManager: This is in charge of actually managing and creating the waves in the water. It uses overlapping clusters of Gerstner Waves to generate a realistic ocean. There is a MaterialParameterCollection which goes along with the BuoyancyManager; if this collection is set, then any defaults set up in the BuoyancyManager will be propagated to the MaterialParameterCollection. Keep in mind that this class is intended to be a child of the GameState class.

  • BoatVehicle: This is a class inheriting from Unreal's WheeledVehicle class. The wheels on this boat are intended to be invisible, and the suspension has a very large drop value allowing the "wheels" to fall to the ocean floor to do their work. There is a very narrow base between the wheels, which causes a larger amount of tilt when the boat takes corners. There are also classes inheriting from the various Wheel classes and the like to support the BoatVehicle class. The BoatVehicle also has a BuoyancyComponent to allow it to move up and down with the waves. The BoatVehicle also has a "stencil" mesh, which is the section of the boat which (ideally) shouldn't have any water in it (i.e., the inside, where the people sit). This mesh is written to UE4's stencil buffer, which is fancy-talk for saying that it'll be drawn on top of the water at all times (unless the boat is sinking).

  • ShipSystem: This is intended for any extra parts which fit on the boat. These can either be visual parts, parts which add extra functionality to the ship, etc. The only class currently implemented that inherits from ShipSystemComponent is the EngineSystem, which provides appropriate engine noises when the ship is throttled up or down.

Content

In addition to the code, there is also a little bit of content included with this project -- namely, 3 water materials, some Material Functions, a Material Parameter Collection, and a lava material.

To view them, go to your Content Browser, select "View Options" (in the bottom right), and ensure that "Show Plugin Content" is checked. A whole bunch of stuff will appear in the Sources Panel to the right (click the little button with a few lines and an arrow in the upper-left of the content browser if you don't see it). What you're looking for is "BuoyancySystem Content". Scroll down in the list until you find it. You should see a folder called Materials, and 2 subfolders -- Functions and Water. Functions contains all the material functions, while Water contains the actual water materials. The base Materials folder contains the MaterialParameterCollection.

The material M_MasterWater is the "main" water material, and the other materials are Material Instances of it. The MaterialParameterCollection WaterParameters is the MaterialParameterCollection that the BuoyancyManager should reference. You can adjust it as need be to fit whatever look you're going for for you water, and those should propagate properly to your BuoyancyManager.

#Installation

First, make a Plugins folder at your project root (where the .uproject file is), if you haven't already. Then, clone this project into a subfolder in your Plugins directory. After that, open up your project's .uproject file in Notepad (or a similar text editor), and change the "AdditionalDependencies" and "Plugins" sections to look like this:

	"Modules": [
		{
			"Name": "YourProjectName",
			"Type": "Runtime",
			"LoadingPhase": "Default",
			"AdditionalDependencies": [
				<OTHER DEPENDENCIES GO HERE>
				"BuoyancySystem"
			]
		}
	],
	"Plugins": [
		<OTHER PLUGINS GO HERE>
		{
			"Name": "BuoyancySystem",
			"Enabled": true
		}
	]

You can now open up your project in Unreal. You might be told that your project is out of date, and the editor will ask if you want to rebuild them. You do. After that, open up the Plugins menu, scroll down to the bottom, and ensure that the "BuoyancySystem" plugin is enabled.

In order to enable the stencil buffer and have the interior render properly, you need to enable the Custom Stencil Buffer. Go to Window > Project Settings > Rendering > Post Process > Custom Depth-Stencil Pass and set it to Enabled with Stencil. This will allow the interior of your boat to be drawn "on top of" the water, which creates the illusion that the water plane isn't actually intersecting the inside of your boat.

A side effect of this is that the interior of your boat needs to be a separate mesh from the outside -- if the entire boat is written to the stencil buffer, it'll always be drawn on top of the waves, and if the stencil buffer isn't used at all, the interior of your boat will flood whenever the water bobs up and down.

After that, you're done! You can subclass ABoatVehicle in C++ or Blueprints and tweak it to your heart's desire, until you have your very own boat!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].