Help! Aiming Mode realtime 3D environments camera

hey, to the point. 'im just stuck with realtime 3D environments camera. i was try to edit the script one 3rd person tutorial from unity but icant. i want the camera like this when aim mode:

please help me. i need a script in JS and of course algorithm itself for my learning.

thanks for you help :slight_smile:

I’m no good with Js, but basically, all you need to do in just perch the camera on the point that is suitable for aiming, then have collision detection (reverse raycasts from the player to the camera) and then just pan in and out on collisions.

Sounds easier than it is although.

any example for the script? i’m still confuse.
well, i’m no good too in JS but if i use C# it more difficult because so many class. so, i prefer use JS

You don’t need to create classes etc. You can do it all in one script if you wanted to. There are video tutorials at a site called 3D Buzz, and they handle a 3rd person camera collision system.

ah, but still i wont use C# because i was familliar with JS.
like i said before, i was edit script from 3d person camera form 3dperson tutorial unity 3d. but i still confuse.
i need example for my case.

void OnAim()
{
transform.position = blabla
}
???