I want my character to rotate around a “target” which is an other pawn but I have some difficulties.
Indeed, when my character rotate around its target, the distance between these two increase more and more.
The best I could do make an increase around 1 unit per second.
Here is a shema, where :
P(n) and dir(n) is the position and direction of the character,
C is the position of the character's target
P(n+1) and dir(n+1) is its (supposed) future position and (supposed) futur direction,
d is the distance which will be (supposedly) traveled by the character,
D is the distance between the character and its target.
I hope my blueprint doesn’t confuse you (like “why delta is multiplied by 5.1?” well I don’t know either why) but it’s the one which is giving me the best results.
Could I have some advice to optimize my blueprint and about the way to rotate a pawn around an other please ?
Thank you for your response, but, the problem is that when I (my character) rotate around the target (with the up-down input), I can also get closer to it (with the right-left input). With your solution, I will have less control on my character movements, especially when I will want to get closer to my target.
Ok, I think I’m beginning to understand. You want your character to orbit the other pawn. Up/ Down would move your character along the orbit and right/left would decrease/increase the radius of that orbit. Is that it?
It is because if I update the character’s world location instead using the “add movement input” node, my character will not use the walking animation anymore. Am I wrong ?
Is there a specific reason for not just using an angle to determine where the player should be? You can just update your character’s world location by multiplying the sine and cosine values of that angle with the desired radius.
So, should I use the “set actor location and rotation” node with a little delta and set the blendSpace speed with the pseudoSpeed, so it may create the illusion of movement ? If I want a fluid animation, won’t it be slow if I use the “InputAxis” node ?
You can cheat though. Your animation blueprint uses pawn velocity to determine the blending weights. In order to replace this, you can get the difference between the current and previous locations of your character and divide it with the delta seconds to get your pseudo-speed. Use it to update the value in the animation blueprint as I do in the screenshot:
I understand how you get the speed and a little how you use it but what I don’t is : what are you using for the character deplacement ? Because if you use the “set actor location” node, I am sure there will be conflict with my character moving closer to the target using the “add movement input” node. Can you enlighten me please ?
I tried to use your blueprint, but I realized that with it, I can’t jump forward. I think it’s due to the character velocity, which is null when we use setActorLocation node instead of the AddMovementInput one.
So it may not be the right solution for my problem (well I never said before I could jump. sorry. ><) but thanks a lot for your point of view