hi,
just one more question, where should the character face ? because if the character will always look in center of the circle if will go in circles but with sidesteps
The yellow cube (Cube) is at 0,0,0. Rotating the actor will rotate it just as a it would alone.
The grey cube (Cube1) is at 400,0,0. Rotating the actor will rotate it in a circle orbiting 0,0,0. 0,0,0 is where the yellow cube is, so it’ll look like it’s orbiting the yellow cube in this example.
To rotate it as mentioned above, you use the set actor rotation node and change the Z (Yaw) value:
That would be forward. So it means that we are looking at the back of the cube in this case.
The bottom of the cube should stick to the path. So when it is on the top of the circle it would be upside down.
I am trying to understand (new to this)
So what you are saying is we can make a cube orbit around another cube. Like the moon orbits the earth? That seems reasonable to do. But then how would I control this value? Or add a controller (joystick) to it to change that orbit value? Thanks in advance for helping me out!
It’s not actually rotating around the other cube. It’s rotating around the location (0,0,0)- the location the other cube just so happens to be at (0,0,0). It’s like the moon orbiting a non-existent/infinitely-small earth.
To control it, you would do the following in your character blueprint.
Keep in mind that you’ll likely have to change stuff if you’re using a template (like the 1st person shooter and top-down templates) to get the rotation to work.
To change what input is being used, you can change the GamepadLeftThumbstickY-Axis event there to something else- it’s available for most keys. The Y axis should be left and right- contrary to every graph you’ve ever seen. Gamepad is a general term used to refer to all controllers.
Of course, this is only when you’re new. When you get more comfortable with the engine, use Unreal’s EnhancedInputActionMappings system. You’ll need to for keybinds.
Axis => will be the axis of rotation, can be any in this case (0,0,1)
Offset => is just how far it should be away from the center or any other object if you add to it… in this case (0,-400,0)
MoveAngle => will be the speed of rotation (90 for the demo)
CurrentAngle => is the result, but you can make a default value to start at any point (360° input)
the optional is for facing in the direction of rotation… can be deleted