Kyle Shaffer (kyleisdank)

3 answers · asked · Lesson: Using Iron Sights · Course: Fundamentals of Weapon Mechanics in Unity

Alright so Ive got a question. The script works great on its own, but in the environment I've got set up it doesn't. Ill r...

Alright so Ive got a question. The script works great on its own, but in the environment I've got set up it doesn't. Ill run you through what I've got. Ive got a sphere as my "Person". He has movement scripts to go left, right, etc. Parented to it is my Camera, which follows me around. Parented to that is my gun. After I apply this Zoom in script, for some reason my Sphere person can move around, but my gun stands still. I'm able to zoom in, and it looks great. I think it might be that my handgun rig is separate from my sphere. Any Ideas? I'll continue to test.
  • Ahh, so after Applying this script to my Main Person (The Sphere) he is also not able to move. So something about this zoom in script is "Rooting" my object. I think it has something to do with the ZoomV and CurrentV.
  • crew
    This course didn't introduce movement so the script doesn't account for that. In the FPS UI Design course the script was modified for movement and was replaced with "transform.LocalPosition" instead of "transform.position". So instead of using the global positions it'll use the local positions of the object. There are a few other changes made as well in that course so I'd recommend watching that or just looking at the scripts in that course. Let me know if you have any other questions.
  • That worked perfectly. I LOOVVEE this site. Thank you for everything you do!