C
C#5mo ago
Zelf

Unity aim down sights

Hello, I am currently struggling with some logic in developing my first person shooter on unity. I'm working on getting the gun to aim down sights for different optics without having to manually set a position for each of the available optics the gun can use. Does anyone have any idea on how I can take a point from a child game object (the optic) and have the parent game object (the gun) move so that the child game object is in line with the middle of the screen. I'm not asking for the code itself, just the logic.
4 Replies
Zelf
ZelfOP5mo ago
i want to make this work with different optics so i want it to be something where i dont have to manually set coordinates for each gun optic combo
m!ke
m!ke5mo ago
I would recommend just using camera stacking. Just overlay the gun and the sight on top of the current camera an it will lead to the same effect. Otherwise you can just use some cheap vector math. Scriptable objects for the positions of optics
Zelf
ZelfOP5mo ago
Thank you!
m!ke
m!ke5mo ago
You’re welcome. :)
Want results from more Discord servers?
Add your server