New answers tagged


We can keep track of how many quarter-turns we've travelled, counter-clockwise from the start angle (this can go negative for clockwise turns). Then we can measure our current angle relative to the last quarter-turn milestone we crossed. Because that milestone is never more than 90 degrees away from our angle last frame, we can move just shy of 90 degrees ...


Found the solution add a second game object to parent the camera holder game object


You can calculate the correct physics world gravity with the help of the acceleration method in the Input class. Physics2D.gravity = 9.82f * Input.acceleration.normalized; The code example above uses a gravity force of 9.82f, and by multiplying that value with the device' accelerometer value (normalized so it's between 0.0f and 1.0f), the physics world's ...


Assuming you have the Transform for your target object, and the Transform of the body the head is attached to, you can compute whether it's on the left or right side of the body by looking at the sign of the dot product: Vector3 toTarget = target.position - body.position; float dot = Vector3.Dot(toTarget, body.right); if (Mathf.Approximately(dot, 0f)) { ...

Top 50 recent answers are included