Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Gunship's engine doesn't stick with player when moving

Discussion in '2D' started by PhaazeReborn, Jun 1, 2020.

  1. PhaazeReborn

    PhaazeReborn

    Joined:
    Apr 11, 2020
    Posts:
    10
    Whenever I move, the engine goes ahead and doesn't stick with the gunship. I made the prefab a child of the player, not sure what to do here.
     

    Attached Files:

  2. Derekloffin

    Derekloffin

    Joined:
    Mar 14, 2018
    Posts:
    322
    Well, there isn't much to go on here, but my guess is your engine has a separate movement script to the player and is getting the combined effect of both movements since it is a child.
     
  3. PhaazeReborn

    PhaazeReborn

    Joined:
    Apr 11, 2020
    Posts:
    10

    No that's not it. I simply dragged and dropped the particles onto the player object. Is there anything I should send?
     
  4. Derekloffin

    Derekloffin

    Joined:
    Mar 14, 2018
    Posts:
    322
    A picture of the objects in questions setup and any script that controls movement (in appropriately code tags when posted) would be a good start.
     
  5. PhaazeReborn

    PhaazeReborn

    Joined:
    Apr 11, 2020
    Posts:
    10
    Player controller script, inspector for the player and my gameobjects
     

    Attached Files:

    • u1.PNG
      u1.PNG
      File size:
      15.5 KB
      Views:
      287
    • u2.PNG
      u2.PNG
      File size:
      62.3 KB
      Views:
      283
    • u3.PNG
      u3.PNG
      File size:
      31.3 KB
      Views:
      278
  6. Derekloffin

    Derekloffin

    Joined:
    Mar 14, 2018
    Posts:
    322
    Nothing stands out to me so far, but not seeing the full script (although don't think it would matter). Is there any script on the engines themselves?
     
  7. PhaazeReborn

    PhaazeReborn

    Joined:
    Apr 11, 2020
    Posts:
    10
    Okay I'm thinking here?
     

    Attached Files:

  8. Neomedus

    Neomedus

    Joined:
    May 14, 2020
    Posts:
    47
    Maybe try turning on inherit velocity? If that doesn't work I would just try to play around with all the settings until it works out.
     
  9. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    Does the engine object have it's own Rigidbody2D/Rigidbody?
     
  10. PhaazeReborn

    PhaazeReborn

    Joined:
    Apr 11, 2020
    Posts:
    10
    No it does not.
     
  11. PhaazeReborn

    PhaazeReborn

    Joined:
    Apr 11, 2020
    Posts:
    10
    Okay so I have no idea what I did, but I was messing around with the z axis because some sprites weren't showing during game view. After fixing it, the flair now sticks to the gunship....yeah idk but glad it works.
     
  12. Derekloffin

    Derekloffin

    Joined:
    Mar 14, 2018
    Posts:
    322
    I think I ran into something that might explain it. I had a inadvertent z on one of my vectors and I was normalizing said vector. However, even though z is ignored for the movement, it doesn't get ignored in the normalize and was suppressing the x and y. Not sure that is what you ran into, but if you have some vector3 math going on it could be the different z's were having a similar unexpected effect.

    Another thought hit me, it could be a camera mode issue. I would think you would notice in other ways, but it is possible it is still giving you some perspective in 3D and even though the position info is the same, the camera could display them at different positions due to the mode. Might want to check your camera settings if this sort of issue pops up again.
     
    Last edited: Jun 4, 2020