Trouble Getting Arm To Point At An Object With IK?
So, I've been fooling around with IK and have been trying to create an effect similar to that in the video linked below. I want to be able to walk up to an object, have my skeletal mesh (arm) detect the object, and reach for it. I've tried using the "look at rotation" node and such, but have not been able to get the intended effect. I'd really appreciate an in-depth explanation of how I could go about doing this, as I'm still pretty new to Unreal 4. Thanks a lot in advance!
PS: It's also worth noting that I don't have a great grasp on C++, so I do pretty much everything via Blueprints. So an explanation that veered away from C++ would be great.
http://imgur.com/a/CBSzm (Here is an imgur gallery featuring all the screengrabs I intended to have in this post before I found out there was a 5 picture limit.)
Apologies for the wait. There was a bit of a family emergency which delayed my finishing this guide.
So, basically how it works is, there is a collision box surrounding the door (or whatever object you want the arm to be attracted to). When the player either enters or exits the collision box, the following is triggered within the door’s blueprint.
[Door Blueprint] As the comment says, this section inside of the blueprint detects if the player is near the door, casts to the MyCharacter Blueprint, sets off a custom event, gets the transform location of the door knob (really a collision sphere placed over the door knob as in the imgur gallery), changes several other variables and finally enables the player to press a button to open the door.
[MyCharacter Blueprint] In this snippet from the MyCharacter Blueprint the other side of that Interact Event from the previous picture (Door Blueprint) . When it’s triggered, it sets “At Interact” to either true or false, sets Hand Location to the coordinates of the doorknob (come to think of it, you may want to set this to zero whenever "at interact" is false just to keep any unwanted glitches from occurring), and finally sets the Alpha which you can basically think of as the intensity of attraction between the arm and the doorknob. Set to 1 the effect is very noticeable, anything lower gets more and more subtle.
[Animation Blueprint Event Graph] Now that we have the Blueprints sending the required data to the MyCharacter Blueprint, we can move onto the event graph of the Arm’s Animation Blueprint. The above basically just casts to MyCharacter, gets those values, and sets identical variables in the Animation Blueprint to the same respective values.
Then, in the Animgraph in the Animation Blueprint, you need to create a new state machine. (Not pictured due to photo limit)
I have my normal state set to just be the first frame of my “Arm Raise” animation. (Not pictured due to photo limit)
[AtDoor State] This is the inside of AtDoor. It plays the arm raise animation, and uses FABRIK for the IK business.
Here are my FABRIK settings.
This may not be the perfect solution, but it worked for me! Not bad considering there was even less documentation available back when this was made. If you run into any more trouble or anything is confusing just let me know and I’ll do my best to help out!
Thank you so much for the details!!! This has helped a lot! I've never actually had someone respond to me on here, haha. I don't have what I want to happen working completely, but I'm a lot closer now! Thanks!
answered Feb 10 '16 at 09:18 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here