Camera min/max zoom


(Helgard de Barros) #1

What I want to do is when my player talks to an NPC, the camera must zoom in. When he stops talking to the NPC it must reset to its normal min/max zoom distances.

I have tried several ways but can’t get it to trigger when I interact with the NPC.

31

Do I need to check which camera first, or does this block automatically return the player camera?


(Leslie Young) #2

I assume you have “allowZooming” on, on that camera.

The problem is that zooming is only applied when “zoom input” is detected since it zooms in/out by how much the input (scroll wheel for example) changes.

It might be better to have a second camera which follows the player around (perhaps just make it child object of player) and have the correct angle and position to look good for the interaction. Then you can simply disable the play camera and enable this one while interacting.


(Helgard de Barros) #3

Thanks Leslie,

That works perfectly. I also added a look at function, so when the player right clicks on the NPC, it turns him to face the NPC, and then switches the camera. On the interact stopped it just switches back to the main camera. Looks way better now when talking to characters.

The NPC’s have basic random facial animations, like blinking eyes etc. Now if only I had the money to record 55 voice actors and make the NPC’s actually talk that would be awesome, lol, but I suppose I can’t have all the pretty things…


(Helgard de Barros) #4

For some reason I can’t figure out, when I end the interaction, and it switches back to the main camera, it is playing the first footstep sound on my footsteps script.

The audio source is not set to play on awake, so it can’t be that it is just playing when activated, and that audio source isn’t on the camera anyway, it is on the player model.

And I thought that maybe when you ended the interaction it thought the player moved and played a footstep sound, but it is playing the first sound in the list, if he is standing on the ground or on wood it is still playing the default ground sound.

It’s not a game breaking bug but it is annoying and I can’t understand why it is happening.


(Helgard de Barros) #5

OK, figured out why it is happening. Unistorm creates an audio source on the camera to play it’s weather sounds, and this is interfering with the switching between cameras. Will ask the Unistorm guys how to fix…