Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    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:
    805
    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.