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

Question Trying to work on Camera Shake mechanics, need some guidance.

Discussion in '2D' started by kpman2300, Oct 27, 2020.

  1. kpman2300

    kpman2300

    Joined:
    Oct 5, 2020
    Posts:
    32
    Gunerror.PNG gunscript.PNG Neither my gun, nor my bullets are facing towards the mouse. What should I do?
     
  2. Cornysam

    Cornysam

    Joined:
    Feb 8, 2018
    Posts:
    1,453
    For the gun, have you tried messing with your "offset" float value? Hit play and try changing it to see if thats the issue.

    Here is a tutorial that should help if that advice above doesnt work.

     
  3. kpman2300

    kpman2300

    Joined:
    Oct 5, 2020
    Posts:
    32
    When I change offset float value, my gun does start pointing towards the mouse, but the bullets as you can see in the picture are shot from the upper side of the gun and not from the barrel. Shot point is shooting upwards.
    (BTW, I used this video only for reference.)
     
  4. Cornysam

    Cornysam

    Joined:
    Feb 8, 2018
    Posts:
    1,453
    Then you should adjust your shotPoint to balance your Offset value. You will need to mess with both to get it facing the right direction. As for the bullets, try something like this: https://answers.unity.com/questions/1352925/rotate-projectile-sprite-in-the-direction-it-is-fl.html
     
    kpman2300 likes this.
  5. kpman2300

    kpman2300

    Joined:
    Oct 5, 2020
    Posts:
    32
    Capture.PNG I want my camera to shake when my projectile gets destroyed but the error says that "namespace name 'Shake' could not be found." but I don't see any problem in the script.