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

2D Proxy Rendering Object, how?

Discussion in 'Physics' started by Deeeds, May 15, 2018.

  1. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    I've got a spinning physics object, that's spinning too fast for enjoyable visualisation and perception by the player. It moves around a lot, and spins really fast. I want to show it spinning slower, whilst it's actually spinning FAST.

    My solution/idea: put a sprite in front of it, that moves with it, that spins slower, and changes texture based on spin rate, as a visual proxy for the underlying object.

    The proxy has a rigid body and I set the angular velocity to a percentage of the actual object. That part works, quite nicely. When they're not connected.

    However, if I nest the proxy sprite to the object, this causes it to spin at the same rate as the parent object, regardless of how I try to control it. It moves well, with the object, but rotates too well, at exactly the parent object's rate.

    If I un-nest it, and move it to the position of the object every frame, this always creates some lags and other side effects, but I do have perfect control of the spin rate.

    Is there some elegant and simple solution to this type of problem I'm overlooking, where I get perfect positional representation and control over the speed of spin of the proxy object?
     
  2. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    899
    Have you tried doing it the other way around, that is parent the main object to the proxy object?
     
  3. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    Yes, I did this first, by mistake. It caused all sorts of weirdness. Couldn't get it to be at all useful. Then I remember that WheelJoint2D is wheel to body, flipped the parenting and it worked, but just not well. Lag, sag and other issues.