|
Post by archieandrews on Sept 7, 2019 11:43:12 GMT
Hi I have trigger generic action that plays an animation and sets a custom camera state.
What would I would like to do with the custom camera state is have it track an object NOT the player. In my case a football
Objective: Penalty Kick:
Player kicks the ball - triggers a kick animation and sets custom camera state, ball is launched using physics add force. Works fine. Custom camera state has a camera mode of fixed point, placed behind the goal area.
How can I then make that camera follow the ball as the target instead of the player?
Thanks Archie
|
|
|
Post by archieandrews on Sept 8, 2019 9:26:24 GMT
Would a solution be to edit line 333 of the vThirdPersonInput script? By assigning a Gameobject.transform instead of this.transform and apply some logic to switch between maincam and the target object?
if (tpCamera) { tpCamera.SetMainTarget(this.transform); //edit this line?? tpCamera.Init(); }
|
|
|
Post by archieandrews on Sept 8, 2019 9:35:33 GMT
Would a solution be to edit line 333 of the vThirdPersonInput script? By assigning a Gameobject.transform instead of this.transform and apply some logic to switch between maincam and the target object?
On second thoughts after testing it kind of follows the ball but its following the balls rotation etc so its not a smooth pan. Maybe it will have to be a cutscene instead.
if (tpCamera) { tpCamera.SetMainTarget(this.transform); //edit this line?? tpCamera.Init(); }
|
|
|
Post by Invector on Sept 9, 2019 13:26:09 GMT
Call the method SetMainTarget from the TpCamera and assign the transform you want as target
|
|
|
Post by Invector on Sept 9, 2019 13:27:11 GMT
Btw you can do it using Events, no need to code at all if it's a simple situation
|
|
|
Post by archieandrews on Sept 18, 2019 12:48:27 GMT
Cheers thanks! will take a look
|
|