Home Creators Posts Import Register Favorites Logout
haven't archived this post yet. have a subscription? use the importer!

Downloads

  • ai_05_weapon_ik.zip

Missing 1 full-res photo, 1 file, as this post has not yet been imported.

Files

Previews only

How to aim a weapon using inverse kinematics in Unity [AI #05]

This tutorial Use Inverse kinematics to create a custom weapon ik system to aim a weapon at a target object by rotating the spine bones of your character. This makes it really easy to aim your AI agents at their foes! Project files available here! ► https://www.patreon.com/thekiwicoder Previous Episode (Equip Weapons): ► https://youtu.be/_c-r1S4PZb4 Follow Me: ► Discord: https://discord.gg/dX4trAG/ ► Patreon: https://www.patreon.com/thekiwicoder/ ► Twitter: https://twitter.com/the_kiwicoder/ ► Instagram: https://www.instagram.com/thekiwicoder/ ► TikTok: https://www.tiktok.com/@thekiwicoder/ ► TheKiwiCoder: http://www.thekiwicoder.com/ Kia ora! 0:00 Weapon Ik: 0:18 Constraint weight: 2:48 Multiple bones: 3:19 Bone weights: 4:37 Limits: 5:23 GameAPI: 7:33 Agent Integration: 8:01 Updating Mesh Sockets: 10:19 Ka kite!: 13:12 #unity #thekiwicoder #weaponik #inversekinematics #aimingaweapon Thank you! TheKiwiCoder

Comments

Josh Cantie

Hi Kiwi, love this series! Had a question regarding this video: I still have the mesh socket system from your previous video on my AI agent, and when I rotate the spine towards an object, the weapon doesn't rotate with the agent. I'm not sure why - the spine rotates and hence the right hand rotates, and since the "right hand socket" follows the right hand, then you would think the weapon would follow too. Any ideas? Thank you :)

TheKiwiCoder

That sounds tricky, are you using animation rigging to rotate the spine, or the weaponik script? I’m wondering if it’s the latter a rigtransform component may need to be added to the socket to have animation rigging update it..

Josh Cantie

I'm using the WeaponIK script to rotate the spine, and for whatever reason the weapon doesn't follow. I'll try playing around with some more anim rigging settings, though, to get the weapon to move with the rest of the rig.

Josh Cantie

Nevermind, you actually address this in the same video - it's the section "Updating Mesh Sockets." I was just working on the continuation of the AI agent from the start, and hadn't gotten to this part yet. You just choose to remove animation rigging entirely, which I did as well. Sorry for the confusion, I just needed to watch more! :) Thank you!