Dealing with Unity Forces for Statics Game Concept

AddForce – Unity Official Tutorials

Youtube – AddForce – Unity Official Tutorials

The bare basics of scripting forces in Unity with rigidBody’s. The AddForce can take two inputs: a vector for direction and magnitude, and what type of force it is.

ForceModes
  • Acceleration – Continuous change; not affected by mass
  • Force – (Default) Continuous change; affected by mass
  • Impulse – Instant change; affected by mass
  • VelocityChange – Instant change; not affected by mass
AddTorque – Unity Official Tutorials

Youtube – AddTorque – Unity Official Tutorials

The bare basics of scripting torques in Unity with rigidBody’s. The AddTorque can take two inputs: a vector axis to apply torque around, and what type of torque it is. This is very similar to AddForce. Important to remember, Unity uses “LEFT HAND RULE” for rotation.

ForceModes
  • Acceleration – Continuous change; not affected by mass
  • Force – (Default) Continuous change; affected by mass
  • Impulse – Instant change; affected by mass
  • VelocityChange – Instant change; not affected by mass
Game Ideation
Engineering Teaching & Research Equipment – Armfield

EF-1.1 – Statics – Forces experiment kit
Youtube – EF series video Statics Forces 1 1 3

The links are similar videos, the first is just directly to the site of those that made the kit, and the second is a Youtube link. This kit provides hand on experience for understanding a lot of topics based around static equilibrium. Topics such as 2D shape center of masses, force vectors, and much more can be covered with this tool.

Game Idea – Engineering Statics Game

Following the general idea of the kit shown above, the game environment is populated with nodes that apply controllable forces to a central ring object. These forces can be altered to change the position of the ring. The environment will spawn collectibles that the player must direct the ring towards in order to collect them. To move the ring, they will need to intelligently alter the forces applied by the nodes.

Quick sketch of concept
Concept visualization of force body diagram to show how game can function.

Gear Mesh Generating Web Build

Link to Web Build of Prototype Currently

Current Controls
  • Left Mouse Button – Press: Select a gear to make it active
  • Let Mouse Button – Drag: Move selected gear around
  • Left Mouse Button – Drag + Spacebar: Destroy selected gear
  • w : makes the gear spawning object the active object (instead of any gears)
  • Typing in input fields: Changing the number in this input field will alter the corresponding parameter of the currently active (selected) object.

Selecting a gear and changing the value in the input field will immediately change that corresponding parameter on that gear. For example, if you left click a gear, then type the value “1” into the “Body Radius” input field, that gear will have its body radius value immediately change to 1, and its mesh and colliders will update along with it.

There is an invisible gear spawning object (“gear spawner”) that creates a gear when the “Create Gear” button is pressed. The gear created will have values based on whatever the spawner’s current values are. To change the spawner’s values, the spawner must be the active object. This is where the “w” key control comes in. Once the player presses “w”, as long as they don’t left click another gear in the mean time, changes to the input field will become the values of the spawner. Then the next time the “Create Gear” button is pressed, it will use those updated spawner values to create the new gear. This gear can then be altered as any other gear.

Current Issues to Avoid

The input fields do not show the values of an object when it is selected. This can be a bit confusing since it makes it hard to tell what the currently selected object’s values are, unless the player just remembers them. This is something that would be crucial to update as there is currently no way to actually see the current values.

The spawner does initialize at all values of “0”. Just be aware that if you try to create gears before changing the spawner’s parameters, you will be creating invisible empty objects.

When attempting to update the spawner, make sure to press “w” before changing any values in the input fields. This was something I found myself messing up a lot, and would be a feature to improve in the future. Again, make sure to press “w”, and not click any other gears, before changing the input fields to update the spawner’s values.

Example setup of gear mesh generator in Unity’s editor.