alexx
New vMember
Posts: 24
|
Post by alexx on Jan 7, 2021 11:20:41 GMT
I took ThrowManager from the example scene and attached it to my character. All is working fine as in the test scene, but i dont like some moments. 1) I want the Canvas from ThrowManager not to be shown all the time, but only when there is a grenade. If there are no grenades, the canvas is not shown. 2) I want the grenade to be visible in the character's hand until the moment of throwing. It seems to me that this can be done through an animation trigger, but I do not know how to do this. 3) At the moment of aiming, the camera moves strongly down to the feet of the character, the stronger the further the throw. This is not very convenient for the player. I will be grateful to the creators and the community for constructive answers. Thanks alot and happy new year!
|
|
|
Post by Invector on Jan 7, 2021 12:45:42 GMT
1- you can use the events onEnable/Disable aim or create your own events to enable/disable the hud
2- check this tutorial:
3- same thing as #1 you can use the events to change the cameraState to a custom cameraState
|
|
alexx
New vMember
Posts: 24
|
Post by alexx on Jan 7, 2021 18:34:06 GMT
I will describe what I did, perhaps it will be useful to many.
The second point I think will not cause difficulties, so I will briefly describe it. I took the mesh of grenade and attached it to the right hand, where default handler is. You will need to adjust it to fit your hand so that it looks natural. Turn off the object by removing the checkbox. Attach the script V AnimatorEventReceiver to our character as described in the video. Attach script V AnimatorEvent to animations on the animator tab and configure it as shown in the video. These scripts will turn on and off our object, in this case a grenade.
Point one will be a little harder to do. I did it in a similar way, if someone did it better, please write here about it. Expand ThrowManager. Turn off grenadeIcon, CurrentThrowObjects, /, MaxThrowObjects, Image (if you use it). Attach script Timed Event to each of these objects. Set the script timer and specify the same object to turn off. In ThrowManager script on Enable Aim we specify all our disabled objects to enable. Also, we set a parameter TimedEvent.StartTimer for each object(specify the desired interval). If you do not do this the timer will only work once. We do the same in the section On Collect Object in script V ThrowManager.
I haven't been able to improve the camera's performance while aiming yet. As soon as I can do it, I'll add it here.
|
|
alexx
New vMember
Posts: 24
|
Post by alexx on Jan 8, 2021 7:59:58 GMT
There is one more problem. Example prefab is with one grenade. Сhanging the value Current Throw Object to null in the script V Throw Manager doesn't change anything. But if you change the value up, then everything is correct. Apparently an error in the script.
|
|