So, I recently made a dog for my survival game. I’m sure the terms “dog” and “survival” gave out a clue, didn’t it? If you didn’t catch the clue, I’m saying that if a dog gets too close to you, the dog bites on your arm. Then you’re forced to wrestle or fight the dog off.
The idea is to run this piece of code with a percentage of say, 0.2, in order to make your player rotate towards the dog.
(you need to run it on multiple frames to actually rotate smoothly the player)
I know alignAxisToVect can do weird things, but you could also play with worldOrientation or whatever.
+1 to wknight02’s solution, for a visual example, check out alien isolation, specifically when the player is caught by an android. The functionality there is exactly what you’re looking for.
Another interesting idea is to use copy location constraints to drive your dog’s head ik animation and then use python to lock the ik target on to the position of the player’s arm, and since your dog’s ik rig will react dynamically in real time you probably could get away with fewer keyframes or none at all for an attack animation
this approach simplifies the whole procedure, and exactly why procedural animation saves time
Yes but if the dog comes biting from behind, and you have an animation where it gets your arm in his jaws, you might want to make the player rotate a bit before playing any IK drive animation ? Never done it so idk…
basically the ik target bone is the one moving the entire ik chain during the game, by combining the copy location constraints, the ik target can now copy another game objects(lets call it snapper) position, this is how foot planting is done in bge
the python script to control snapper’s position can either be triggered by raycast or collision, depends
So how could I make the dog’s head snap to the player’s arm? I got the snapper segment down, I’m just curious to know about the how they’re going to snap.
I assume that this requires an empty in the dog’s mouth and on the player’s arm?
AFAIK, dogs don’t care if you are facing the right direction when they attack you…to me…it would be annoying to lose control of my character due to this mechanic…from a players perspective…
…in other words.
You may be making this more difficult than it needs to be…ofc, only you can decide and I will leave you with that.
Aye, okay. I did actually make them snap each other at the origins so no errors would occur. I was considering on constraining the dog a certain distance.