Download

How to force player into specific location and rotation?

I’m doing a “bite” on an enemy and not sure of the best way to do it.

Currently using a “SetActorLocationAndRotation” at an offset location on the enemies mesh to make player position shown standing behind the enemy as “bite” animation plays (and enemy’s “being bit” animation plays)

But it doesn’t work all the time… I am guessing due to collision issues?

Is there a way to FORCE and location/rotation at a specific location even if it means clipping into the enemy actor?

What is the best way to do animations like this? (that absolutely need to be positioned perfectly)

Thanks

I think its possible but need a bit(a lot) of work…
You will need probably IK for this…
Lets say you are vampire and you want to bite another human…
First move player capsule with mesh behind human.
Then you can create socket in human skeletal mesh e.g. “bite location”
Then get bite location and use sime kind of blend animation, stretch neck and head to that location…

I dont have idea if this can work but imo there is no another way… it will be quite hard to do this but good luck!

Name368 has good points.

Your problem has probably something to do with the collision of the capsules, like you pointed out. The most efficient way would be to get directly behind the enemy, use a button or something to bite, check if a linetrace hits (you don’t want to stand miles away) and then on hit, play an Anim montage and disable the movement of the enemy character. That way you won’t get a weird behaviour, when the enemy decides to take an enthusiastic walk, while you are feeding :).

In terms of the capsule problem: The best way is to add a scene component to an enemies blueprint. Call it something like “BitePosition”. When the line trace is true, scale your capsule to half the size (radius, not height) and snap to the enemy’s “BitePosition” (Set world location). You can reposition the “BitePosition” to fit your animation. It has helped me in the past. There are naturally also more things you will stumble upon, but it gives you maybe some kind of idea :).

Use animations with offsets in both characters, when the bite begins blocking the inputs and capsules and synchronizes the animation of both characters.

Like root motion but without moving the capsule.

https://docs.unrealengine.com/latest/INT/Engine/Animation/RootMotion/