Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Drag Camera Rotation Sensitivity Issues

Discussion in 'iOS and tvOS' started by redthrawn, Apr 24, 2015.

  1. redthrawn

    redthrawn

    Joined:
    May 8, 2013
    Posts:
    27
    I have implemented a system where the player can rotate the camera and so far it has worked great on Android. Running the same code on an iOS tablet with roughly the same ppi results in a drastically increased rotation sensitivity.

    Here is the code I have on my camera:
    Code (CSharp):
    1.  
    2. var t = Input.GetTouch(0);
    3.  
    4. float dt = Time.deltaTime / t.deltaTime; //sometimesTouch.deltaTimeis0 :/
    5. if (float.IsNaN(dt) || float.IsInfinity(dt))
    6.      dt = 1.0f;
    7.  
    8. x_velocity += t.deltaPosition.x * dt * 0.2f;
    9. y_velocity += t.deltaPosition.y * dt * 0.2f;
    10.  
    11. transform.rotation = Quaternion.Euler (y_velocity, x_velocity, 0);
    12. transform.position = Focus.position + Rot * newVector3(0.0f, 0.0f, -Distance);
    13.  
    I'm thinking perhaps I should put this sort of thing in FixedUpdate()? Anyone have any ideas?
     
  2. mark_ff

    mark_ff

    Joined:
    Jul 24, 2012
    Posts:
    21
    I don't think you need any reference to Time.deltaTime in there...

    Your velocity should be simply t.deltaPosition / t.deltaTime

    Unless I'm really confused about what you're trying to do o_O
     
  3. redthrawn

    redthrawn

    Joined:
    May 8, 2013
    Posts:
    27
    The problem is that sometimes t.deltaTime is zero, and also I need it to be framerate independent.