Skip to main content

PhysicsAcceleration

A class in Root.Township, the global namespace.

Component that adds a constant acceleration to a rigidbody every physics step, with a Wobble method for a random spin.

Constructors​

MemberWhat it is
PhysicsAcceleration()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

4 private and internal fields
MemberWhat it is
private Vector3 accelerationAcceleration added each physics step.
private float maximumAngularImpulseLargest random spin for Wobble.
private float minimumAngularImpulseSmallest random spin for Wobble.
private Rigidbody targetThe rigidbody to accelerate.

Methods​

MemberWhat it is
void Wobble()Gives the rigidbody a random angular velocity change between the min and max impulse.
2 private and internal methods
MemberWhat it is
private void Awake()Uses the rigidbody on the same object if target isn't set.
private void FixedUpdate()Adds acceleration to the rigidbody's velocity.