To be honest if you are trying to a result like the game you linked you are better off using SetActorLocation instead of the CharacterMovementComponent. Or you could attach your character mesh to a spring arm have your spring arm be at the center of your actual actor, then rotate the spring arm.
I Every one , after a long research on the AnswerHub , forum , youtube tutorial, and everywhere on the internet i come here to ask your help because im completely out of idea to make ma character move round a circle.
I have try to many think to explain here all test i have do.
So I juste want to move my character ( my character is a spaceship ) around a circle using ( or not ? ) add movement input, the character can just move around this circle and have to not be able to move out this circle.
I have try with :
- Spline without result
- With rotation but i can just turn it around himself,
- With 2 add movement input, one for up and down and the other to turn right left , but i don’t know how to make a “pivot point” to be sure that im constraint to this location.
I can’t use a Pawn Class because i use many settings in “Character movement component”…
I let you a video of a game who did this because , you will can see what i really want to do.I really new in UE4 and i have passed the 4 last days to try it but i'm a little desesperes ....
PS : Sorry for my english im French.
Sorry for not being more descriptive here, I’m running out of time tonight but thought I would comment to you and say that I think Spline is the way to go here. There are a couple video tutorials I’ve found before to have a character (AI) automatically follow a spline and I adapted those techniques to my specific needs. Try digging a little deeper into using the spline but if either someone isn’t able to give you a full write-up or you can’t find a video to help then I will come back tomorrow and write what I can to help you.
Again, sorry not super helpful just wanted to point you in the right direction.
Thanks for your reply ! So i will try to find some tutorial with AI moving on a spline and try to adapt this !
I will let you now if i find a solution to my probleme.
Granted you can reverse the direction to your liking, this was just a quick proof of concept. Its a character BP, with another mesh attached to a spring arm, and you can attach a collider to that or to the spring arm as well.
If I understand you correctly, it sounds like you should just use some basic trigonometry to move the character around a unit circle. You can then use SetActorLocation to set the characters location around the circle. Let me know if you need further help or if you are unclear on what a unit circle is.
I understand your point ! but if i use a spring arm with the mesh, my capsule collision will not move with the mesh right ?
If you attach the capsule to the mesh or the end of the spring arm, it will move with it.
Yeah exactly the probleme with this method is when a i have a collision the character will move du to the physics of the character and will be push or move from the original world location and will not be in the good world location of the level i think.
Anyway all help is welcome ! thanks a lot!
I will try this tonight ( yeah it’s 11:14 AM here ^^ )
I will let you know the result !
Hello! Using a point as an origin (you can move that point, along a spine for example), you can offset the player using this kind of trigonometry:
You just need to calculate the angle!
P.S. Look at atan2 if you want to do the “reverse” thing
Neither of our solutions will cause that if you have physics turned off. You can even set the actors main componet’s Physics: Constraints Locked for Position in all axis.
Its 5:25 am here lol, Time isn’t real, Lunch time doubly so.
I will try this tonight and let you know if i can apply it at what i what ! but it’s seems to be a good idea ! i have 3 different way to test thanks !
Thanks you for you answer ! i will see how i can use this for my projet but i better understand what really are Sin and Cos now ! so thanks a lot !
After many many hour to try to find a solution , i have see that i already this before but the probleme is the capsule component collision that don’t move with the character … i’m really lost with all of this … i have try to turn off the collision and setup a new one with add collision sphere/box but the probleme that in the character class we need to use the capsule the other collision just not work … so i juste don’t know what to do.
My character have to move by himself forward but no collision are detect so i don’t know
Thanks anyway !
I have try all the solution you all mention here but i just can’t success to do work one of her …
Im really lost and i don’t know what to do i don’t have any idea :s
- All you have to do is make the spring arm the parent of the a capsule collider.
- I already tested all this and it works fine if you are still having issues i’m sure we can help you get it working, this is a really easy thing to achieve.
[Here is a video of what I did before but with a capsule collider attached now.]
Make sure to make the video max quality and full screen or you might not be able to see the collider.
I know the collider can be hard to see while hes moving, so I stop moving every so often so you can see that it is still with him.
I understand your point but the probleme is that the capsule component of a character BP class is the root so he can’t be moved to a parent of SpringArm component