Search Unity

Speed of light in unity?

Discussion in 'Physics' started by MikeyJY, Sep 2, 2020.

  1. MikeyJY

    MikeyJY

    Joined:
    Mar 2, 2018
    Posts:
    530
    Is it possible to make a rigidbody to move with the speed of light?
     
  2. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    Though I can't remember seeing any user projects propelling anything that fast, there shouldn't be many obstacles on the way as long as you admit relativistic effects won't be precisely simulated. ;-)

    Seriously though, could you elaborate on what you're trying to achieve here?
     
    koirat and diXime like this.
  3. MikeyJY

    MikeyJY

    Joined:
    Mar 2, 2018
    Posts:
    530
    I just wanted to test the speed of light in a controlled space like a simulation in a game engine
     
  4. diXime

    diXime

    Joined:
    Oct 2, 2018
    Posts:
    162
    "test" the speed of light?
    What are you trying to test? If you're trying to see what happens to space when moving close to the speed of light, a few approaches may work, either going for non-euclidien spaces (like hyperbolic space), by hard-coding a physics engine taking relativistic effets into account, or simply use the Lorentz transform into a tiny simulation.

    Now many other relativistic effects (cherenkov radiation, snell's law, and so on) are entirely other things to work on and won't happen by themselves by simply making a GameObject moving really fast. You can, if you want, (I have not tested though) set the velocity of anything to 3.10^8 m/s, and the simple fact that it's possible should hint you to the fact that it's not reliable. Also, the xyz coordinates of unity aren't exact meters and seconds, because they only scale within range of float rounding errors (forget about quantum effects!) and float overflow (not much cosmology).

    I'm not sure that a simulation engine is the best place to test any real-life hypothesis, only to build and tests models that would take the engine limitations into account. You kinda have to code the behavior in advance, and anything you'd note from said simulation is to be attributed to the engine or the model you chose to apply.

    If you want mathematical ressources on general relativity, I'll point you towards this video that details the demonstration, keeping in mind that Einstein's equation is not the whole story (Fridman correction because it's so complicated that even Einstein made mistakes, Minkovski / deSitter Space or anti-deSitter Space (tough choice !), and so on)... And I haven't mentioned angular momentum nor Doppler effects.

    The best way to test light is in a laser lab.


    At least in an empty scene, because good luck avoiding planets ;D
     
    Last edited: Sep 3, 2020
    yant and Bunny83 like this.
  5. richardgengle

    richardgengle

    Joined:
    Jul 9, 2020
    Posts:
    9
    hey, did you ever get this speed of light project going?
     
    MikeyJY likes this.
  6. MikeyJY

    MikeyJY

    Joined:
    Mar 2, 2018
    Posts:
    530
  7. MikeyJY

    MikeyJY

    Joined:
    Mar 2, 2018
    Posts:
    530
  8. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    You just need to raycast longer in one frame tick than the light moves in the same time span :p
     
  9. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    Nothing can be faster than light even raycast, that's what physics tells us.
     
  10. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    It was a joke
     
  11. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    Mine too.
     
    MDADigital likes this.
  12. curb47

    curb47

    Joined:
    Jun 19, 2020
    Posts:
    8
    Time stops at the speed of light, so just freeze everything else.
     
  13. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    Time.timeScale = 0;
     
  14. MikeyJY

    MikeyJY

    Joined:
    Mar 2, 2018
    Posts:
    530
    And also the mass of rigidbody should be infinite
     
  15. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    Rigidbody.mass = Mathf.Infinity;

    Now we just need to scale the object along movement direction.
     
    Maeslezo and MikeyJY like this.