ThirdPersonObject only disables visual elements. How to disable other components?

Brendan

New member
I've noticed the ThirdPersonObject and FirstPersonObject scripts will make the corresponding objects' renderers invisible when in the appropriate perspective. However, the items such as weapons are still active in the wrong perspective. If the character is holding a gun, both the third person version and the first person version of the gun are active in the heirarchy and can be seen in the Scene view.

This is a problem because I have scripts and other components such as lights and audio on those weapons. Does anyone know the correct way to make UCC actually disable the objects based on perspective?
 
There isn't a built in way. If the first person objects were disabled then the correct animations wouldn't play when switching to a first person view. If the third person objects were disabled then the shadow wouldn't be correct.

For your scenario I recommend listing to the OnPerspectiveChange event and disabling/enabling from there.
 
There isn't a built in way. If the first person objects were disabled then the correct animations wouldn't play when switching to a first person view. If the third person objects were disabled then the shadow wouldn't be correct.

For your scenario I recommend listing to the OnPerspectiveChange event and disabling/enabling from there.
Cheers Justin, that should work! I'll just add a flag to my weapons to say whether they are first or third person and subscribe them to OnPerspectiveChange
 
Cheers Justin, that should work! I'll just add a flag to my weapons to say whether they are first or third person and subscribe them to OnPerspectiveChange
I am at the learning stage, So would you please give me some hints on how to subscribe to OnPerspectiveChange? Thanks,
 
Top