|
Post by alex100dre on Apr 24, 2017 16:36:23 GMT
Hello and thanks for this awesome tool that is Third Person Melee Combat Template. I'm currently building a VR game and I want the AI to attack an object that is not a vThirdPersonController or another vNPC (companion, enemy...). Actually, I want the AI to attack the VR player. I tried with a cube for the moment that I tagged and layered as "TestTarget". I put the "Tags To Detect" and the "Hit Damage Tags" to "TestTarget" but the AI is just playing the idle animation and nothing happen. Can you tell me if I did something wrong or if I forgot something?
|
|
|
Post by tharindu on Apr 24, 2017 17:00:27 GMT
Hello and thanks for this awesome tool that is Third Person Melee Combat Template. I'm currently building a VR game and I want the AI to attack an object that is not a vThirdPersonController or another vNPC (companion, enemy...). Actually, I want the AI to attack the VR player. I tried with a cube for the moment that I tagged and layered as "TestTarget". I put the "Tags To Detect" and the "Hit Damage Tags" to "TestTarget" but the AI is just playing the idle animation and nothing happen. Can you tell me if I did something wrong or if I forgot something? Did you check if the navigation is set up properly ? For instance is the navmesh baked and all ?
|
|
|
Post by alex100dre on Apr 24, 2017 17:14:24 GMT
Yep, the navmesh is baked. When I put an V_AI or a vThirdPersonController as target the fight start. But when I try to put a cube as target it's not working until I put a V_AI script on it. But my goal is to put a stamVR player as target so I don't want it to have a V8AI script on it.
|
|
|
Post by tharindu on Apr 25, 2017 1:49:51 GMT
I don't think you can do this without taking a look at the detection code and modifying it. Plus I think the Invector ai is exclusively geared to work with the 3rd person controller and doesn't integrate with other apis all that well unless you code yourself a bridge or an adapter of sorts.
|
|
|
Post by uberwiggett on Apr 25, 2017 3:41:31 GMT
maybe the standalone object damage could work?
|
|
|
Post by alex100dre on Apr 25, 2017 13:05:40 GMT
Thanks for your replies. I tried to use the VCharacterStandalone from the PunchingBag and it works ! But for some reason the AI is just walking arround me and blocking. He attack me only if I sit down, and is only blocking/walking if I stand up.
After some tests, I think that we need the collider of the VCharacterStandalone to touch the ground to allow the AI to attack. Am I right? If this is it, I just need to make a script that get the position of my VR headset and put a collider between the ground and the headset right ?
|
|
|
Post by uberwiggett on Apr 25, 2017 13:09:50 GMT
As far as I can tell, the AI tracks the charactee using navmesh so it may need the collider to be in contact with the navmesh surface. OR it could be a matter of the AI is checking for the "is grounded" condition, which I think also means the collider must be in contact with the navmesh surface.
|
|
|
Post by alex100dre on Apr 25, 2017 13:57:50 GMT
Yeah it was because of that. I created an empty with a collider that fit between the ground and the headset and attached to the standalone script and it works (y). Thanks for your help Now just need to be able to attack the AI with a sword and impeach him to pass thought me. I'll update you when I'll finish
|
|
|
Post by Invector on Apr 25, 2017 14:22:39 GMT
Just use the vCharacterStandalone and a capsule collider with rigibody, should work just fine And to apply damage to the AI you could use the vObjectDamage. ps* Recently I'm seeing quite a few users using our AI for VR projects, and now that we're redoing the AI with better performance and more stable, I'm thinking about creating a cheaper package then the MeleeCombat with only the AI and a simple First Person Controller, this could be a good solution for VR/FPS developers
|
|
|
Post by alex100dre on Apr 25, 2017 14:52:16 GMT
That's exactly what I did but with a box collider (should I use a capsule?) and a script that resize it to the size of the player using the Y position of the VR headset. Any idea about how to prevent the AI to pass through me during attack without changing the animations? Thanks for the vObjectDamage I'll look that way! Oh really? Then it should be great to have an AI for VR games
|
|
|
Post by Invector on Apr 25, 2017 16:24:04 GMT
You could add a NavMesh Obstacle into your player, I think this should get the job done along with Capsule Collider + Rigibody
|
|
|
Post by dreadlord on Apr 25, 2017 23:17:30 GMT
I also added a NM Obstacle to the player to prevent that the ai can push the character controller away. Keep the attack distance in mind, maybe you have adjust that too when the enemy can't get close enough to the character controller.
|
|
|
Post by alex100dre on Apr 26, 2017 8:37:10 GMT
Oh nice idea, I'll try that. Thanks angain it's really cool
|
|
|
Post by alex100dre on Apr 26, 2017 12:16:04 GMT
Oh another thing, I followed the tutorial to create a custom model for the AI but I can't apply any damage to it. However I can apply damage and kill the demo AI. I tried to check differencies between the demo AI and mine so I copy/past the enemyHealthUI to my custom AI but it apply damage only once. Also it dosen't activate the ragdoll or animation when I hit it. Here is a video to show you the thing: Did I miss something? The only difference I can see is that the demo AI has more capsule colliders than mine. I don't know how to generate them? Also finally I guess that the obstacle navmesh to impeach the AI to pass though the player can't work because the player is not static, we can walk using the HTC Vive so a baked navmesh can't move with the player right?
|
|
|
Post by Invector on Apr 26, 2017 12:50:24 GMT
hey alex you forgot to add a ragdoll component, it is usually the first thing to add into the character after created. I recommend you to watch this video tutorial to get along the basics: And about the navmesh, we're talking about the NavMesh Obstacle component, and not the navmesh that you bake for the scene. The navmesh obstacle can be used on dynamic objects so that the agent can avoid them, more info here: docs.unity3d.com/Manual/class-NavMeshObstacle.html
|
|