Hot answers tagged

4

Mathematically speaking, a distance is a value which is never lower than 0. You can see this thing in your getDistance() function implementation: the argument passed to the square root function is a sum between powers of 2. A power of 2 is always positive, their sum is positive as well, and the sqrt() function will always give back a positive value. So, no ...


2

AddForce will apply a force for the current update cycle. The force is applied to the RigidBody for that update cycle, then cleared. At the beginning of each physics step, the forces are zero. Then the forces for gravity, friction and calls to AddForce are summed up and added to the RigidBody. Assuming the forces added to the object don't cancel each other ...


1

It depends on how you add it. If you add it once on some callback, for example, or button press\release event, then it will be added once. This once applied force, will affected by other things, like friction for example, which over a period of time will render that applied force value to zero (by decreasing it's every physics update). If you apply it ...


1

Force is applied continuously along the direction of the force vector. Specifying the ForceMode mode allows the type of force to be changed to an Acceleration, Impulse or Velocity Change. Force can be applied only to an active Rigidbody. If a GameObject is inactive, AddForce has no effect. Taken directly from here. Maybe read more on that website. It has ...



Only top voted, non community-wiki answers of a minimum length are eligible