Announcement

Collapse
No announcement yet.

Shooting to screen touch direction in 2d side scroller

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Shooting to screen touch direction in 2d side scroller

    Hi, gyus I am trying to make 2d character to shoot on screen hit location but I have fail with that. Does anybody have ideas? May be you have tried to make it on your own? There is my non-working logics


    With this my character shooting anywhere but not to the screen touch direction .Can you help me , please?
    Attached Files

    #2
    Ok , I have solved this problem , but I have got another one. Evrething works good untill I'm trying to apply forward vector (red circle on the screen)
    Forward vector does note rotate with 2dVector between onscreen player location and onscreen touch hit location. And this causing not accurate shots and projectile spawning only to the right from player
    Last edited by KAPA6UH; 08-07-2015, 03:59 PM.

    Comment


      #3
      You should be careful when you add a float to a vector, as I'm pretty sure that float is added to all three components of the vector, which would make a very different vector.
      If you want to make that vector longer, you should multiply it instead, or add a vector with the components you want.

      Comment


        #4
        Originally posted by KashiKyrios View Post
        You should be careful when you add a float to a vector, as I'm pretty sure that float is added to all three components of the vector, which would make a very different vector.
        If you want to make that vector longer, you should multiply it instead, or add a vector with the components you want.
        Oh thanks a lot . You have really helped me!

        Comment

        Working...
        X