How to Simulate Projectiles WITHOUT PHYSICS in Unity3D

Поделиться
HTML-код
  • Опубликовано: 17 дек 2024

Комментарии •

  • @Alex-ck4in
    @Alex-ck4in Год назад +5

    love pure programming videos, nicely done

  • @amac333
    @amac333 Месяц назад

    this is perfect, I tried a bunch of different approaches over the last couple days but this exactly what I was after.

  • @reggieisnotadog4841
    @reggieisnotadog4841 11 месяцев назад +1

    THANK YOU! This explains this in such a nice way and shows an actual use case.

  • @Nullfighter
    @Nullfighter Год назад

    Dude great fucking video, love how direct and clear and concise it is. You helped me understand and follow without wasting my time.

  • @tommybasile2931
    @tommybasile2931 Год назад +2

    I liked how condensed you made you video and you explained it very well. thank you

  • @eeianbang1900
    @eeianbang1900 Год назад

    cant describe how wonderful this video is THANKS ALOT!

  • @ck88777
    @ck88777 4 месяца назад

    This might be fine for some applications but for a slow moving projectile youll notice it doesnt act like a real projectile. Real projectiles decelerate on the ascent until the vertical velocity is 0 at the peak, then accelerate on the descent. Projectiles' time in flight is also dependent on the initial velocity and distance, which bezier curves fail to account for. I also want my projectile to continue past the point of the target, which would require a further modification that I havent figured out yet.

  • @payasoprince9333
    @payasoprince9333 Год назад +1

    This is really fantastic. Thanks a ton for the video, dude! I noticed that depending on Control's position, the wirespheres become either closer or farther from each other. Because of this, the speed of the projectile changes and can add an unwanted "easing" effect. My problem is that the specific curves I need have this easing issue. Is there anyway to avoid this with curves that smoosh the wirespheres closer?

    • @igorkim3558
      @igorkim3558 Год назад

      you don't need to set transform.position = evaluate(t), instead use transform.Translate towards next checkpoint

    • @payasoprince9333
      @payasoprince9333 Год назад

      @@igorkim3558 sorry, I don’t quite understand. May I please see an example?

  • @jackwo95
    @jackwo95 8 месяцев назад

    Dude you saved my life thank you so much

  • @asalaj5885
    @asalaj5885 2 месяца назад

    Can you move a and b when projectile is already on the move?

  • @rajaharris55
    @rajaharris55 Год назад

    Exactly what i needed, thanks

  • @wickedsnuk3812
    @wickedsnuk3812 Год назад

    This is gold, wp brother

  • @dbweb.creative
    @dbweb.creative 6 месяцев назад

    My question is, why not use Animator curve field to evaluate??

  • @kyroic6128
    @kyroic6128 11 месяцев назад +1

    This same method can be used for my archer towers in my tower defense project?

    • @UnofficialCyane
      @UnofficialCyane 5 месяцев назад

      No sorry it only works for scifi lasers and stuff

  • @Ghin_Antonic
    @Ghin_Antonic Год назад

    Double checking but pretty sure you can, this can be adapted for 2D fairly easily yes? Would there be any issues if we set it up so when the projectile hits something early it also disintegrates?

    • @ForTheOmnissiah
      @ForTheOmnissiah 11 месяцев назад

      If the projectile object is destroyed before it reaches the endpoint, it won't exist any longer to cause any reference problems, though I don't see where references would necessarily cause an issue here. The way it's shown in the video is a brittle way to implement this behavior tbh. All of this can be achieved by modifying the evaluate function to accept 3 Vector3's and the float t, calculate, then just give the calculated Vector3 back to whoever called it. There's no need for a class to extend MonoBehaviour in order to provide this functionality. You could make a static class that just extends Object with just this function in it and it'd work the same, except with way fewer steps, just call it from literally anywhere and get your Vector3.

  • @zendraw3468
    @zendraw3468 Год назад +1

    but how wuld you detect collision detection? does oncollisionenter work?

    • @Rytech_Dev
      @Rytech_Dev  Год назад +4

      This system uses pure mathematics and there is no influence of physics.
      To add in collision detection, in the update function you can run Physics.CheckSphere to see if any objects have entered a defined distance from your object:
      docs.unity3d.com/ScriptReference/Physics.CheckSphere.html

    • @Rytech_Dev
      @Rytech_Dev  Год назад

      For more information on collision detection here is a video I made a while back: ruclips.net/video/NNJs4wYZGvs/видео.html

    • @zendraw3468
      @zendraw3468 Год назад

      @@Rytech_Dev yeah, but do you think the oncollisionenter events will work? i dont think you need to actually move the object thru physics for it to trigger these events

    • @Rytech_Dev
      @Rytech_Dev  Год назад

      "Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached." Therefore, no.

  • @rremnar
    @rremnar Год назад

    This is great when you know points A and B and C (max height). What if you only have point A, an angle, and speed of the velocity; where velocity is the forward vector of your object, who's length is 1. This is what I've been trying to wrap my head around. I need to be able to draw the trajectory based on only my velocity, speed and angle. I've looked into parabolas and stuff, but none of it clicks with me lol.

    • @Rytech_Dev
      @Rytech_Dev  Год назад

      look into kinematics

    • @christopheremerson2848
      @christopheremerson2848 5 месяцев назад

      Can you not have a function in QuadraticCurve like this?
      public void SetTarget(Transform b) { B = b; }
      Then before firing your projectile call SetTarget and insert your target's transform.

  • @tianqigao869
    @tianqigao869 Год назад

    awesome tutorial!

  • @Maskeowl
    @Maskeowl 11 месяцев назад

    u are a legend man

  • @dertobbe1176
    @dertobbe1176 11 месяцев назад

    Thanks alot my mate

  • @TREXYT
    @TREXYT Год назад

    Cool but you did with only 1 bullet, im pretty sure that if we do it with tons of bullets then it will drop fps a lot, by a lot i mean really a lot!

    • @Rytech_Dev
      @Rytech_Dev  Год назад

      well of course the frame rate is inversely proportional to the number of objects. More stuff = More computation time = Less FPS. Since this is a math based approach to ptojectiles, the Unity Job system can remedy this by introducing multithreaded calculations. Hence, the support for larger amounts of projectiles or bullets.

    • @TREXYT
      @TREXYT Год назад

      @@Rytech_Dev can you do a tutorial on that please ? This is really interesting, also multithreading works on mobile project ? Thanks

  • @stormer268
    @stormer268 Год назад

    Cool~ Thanks!

  • @FarwalDev
    @FarwalDev Год назад +1

    Nice 👌

  • @worldkho
    @worldkho 6 месяцев назад

    legend

  • @nTu4Ka
    @nTu4Ka 10 месяцев назад

    Cool video!
    Btw. You can calculate point on Bezier curve in single line:
    ruclips.net/video/pnYccz1Ha34/видео.html