Rotate actor down in the direction of looking

I am trying to achieve the following effect;

ezgif-5-3f65857c0f

regardless of the location or rotation of the actor.

So far I have managed to move actor location from one side of the box to the other downwards in the direction I have my camera facing by creating the component in the appropriate local location and using its coordinates in this way;

However, I cannot cope with the rotation, for days I have been messing with different nodes, it always works maybe up to two rotations and with next the camera spins and ends up in the wrong place. I even tried changing actor rotation towards the component on the underside of the actor, or localrotating this component and copying its worldrotation to the actor, but the effects are the same!

I approached some success by creating a new component in the tree so that I rotate one component relatively horizontally and the other vertically.
The first problem was on the third spin forwards, instead of going forward it was going backwards, so I created a condition that checks this position and goes not -90 Pitch but +90 Pitch with it and it works.

Until a certain combination of rotations that ends in strange coordinates;
Pitch 90 Yaw 35 Roll 35
and after this I rotate, I end in such a distortion;

ezgif.com-gif-maker

These seemingly random changes prevent me from continuing my work.
I encountered strange changes in coordinates previously testing a different spin pattern;
I turning around in the same way, but on the second spin the GetWorldRotation result changes and stays that way with the next spins. Even though the rotation is visually the same;

ezgif.com-gif-maker2

I donā€™t understand why this is happening.

Maybe you clarify what the maneuver is meant to be? ( Itā€™s not obvious from 1/2 sec of GIF ).

It looks like the cubes are rotating around the sphere, which is not moving?

Like this Kula World (PS1) - Demo - YouTube

Gotcha.

So the character is a ball with a spring arm camera. All the cubes are in the level, not in the character.

Then, with the character, you only ever add relative rotation, in increments of 90.

image

( thatā€™s just right, you need all directions of course )

AddLocalRotation can not be used with timeline and do not have OverTime option. I need it to be smoothly. If I use Event Tick i do not have control how many degrees will it take, it need to be exactly 90.

Something like this

So its works once, then just hold same position and strugling when I press D again. Also this smoothness type have bad feeling, its start fast and end slooowly.

Iā€™m looking into itā€¦

Try this

Thing is, it will work more slowly on slower machines.

I forgot to say, this is the setup

Notice how the ball is floating ( because it needs to be above the cube ).

When itā€™s placed in the level, the location of the ball actor needs to be the same as the cube

So that it revolves around the cube center.

ball on cube

It can be easily modified to do Yaw

yaw

1 Like

Very thanks for your efford, so rotation horizontally and vertically seems to work well like this.
But there are two problems;

As you see in this video Kula World (PS1) - Demo - YouTube exacly 0:49 ball make rotation not like ā€œrevolves around the cube centerā€ but kind of opposite.

Thatā€™s why I tried to rotate the actor around a given point as you can see in my screenshot with RotateVectorAdoundAxis in the first post.
I was going to add a second empty component to the ball in such a place that would turn the actor this way as well. I donā€™t know if I can make it, this one I made out by accident :stuck_out_tongue:

The second problem is that by rotating the entire actor we are also rotating the texture of the ball. I understand that it is enough to change its rotation from Relative to World (absolute) in the component options.
However, it then rotates in the direction I set at the node, and I want it to rotate forward relative to where the camera is actually looking, also at the same speed as I move the ball.
For now, I moving the ball by SetActorLocation smoothed by timeline with starting vector from GetActorLocation and ending vector from GetWorldLOcation of another empty component that I have placed in the front at the right distance.

I have a theory, gimme 5ā€¦

1 Like

Yeah, itā€™s complicated, basically.

I started making something, but itā€™s basically writing a game.

When they press ā€˜forwardā€™, I think you need to line some line traces to see whatā€™s ahead.

  1. If itā€™s nothing, revolve around the cube

  2. If thereā€™s another cube next to this one, move forward

  3. If thereā€™s a cube in front of us, revolve upwards ( like in the vid ).

Thereā€™s also the problem of whether to take positions and rotations from the cubes ( one way of doing it ), will always work.

Or, just keep adding location and rotations to the pawn. The problem with this is, if they play for a long time, the pawn will gradually become misaligned with the cubes, because of rounding error.

Sorry to not be more helpful.

1 Like

This does it. Not elegant, but it works.

The BP has two collision boxes to know which way to go

This is up arrow

I put the rest of it in a snippet

1 Like

Thank you very much.
This script allows player to roll down anywhere, in the game it should only be possible to do on the edges, like here Kula World (PS1) - Demo - YouTube but probably its enought to just set up a different type of box in the right places that will detect by lower collision detector, instead of detecting the void.

Still the bigger problem is the rotation of the mesh ball itself. I donā€™t want it to move sideways when the camera is moving, but I want it to roll down in the direction the camera is currently facing, like in Kula World.

I watched the vid, I think it only does the same thing as KW. Can you show it doing something itā€™s not supposed to?

As for the ball, it should be pretty easy to make it do the right thing. Only rotate it when moving forward. But also it should turn with the camera.

I just put this

image

on the end of

RotateForward and MoveForward.

I forgot to mention, the cubes in the level should have ā€˜generate overlap eventsā€™ ticked, to make the collision boxes work correctly.

ball

The code can also be made much more compact. Iā€™m sure you can see a lot of repeated sections thereā€¦

2 Likes

No, no. In Kula World, you can only roll down at the top of the geometry you are walking on. In this way;


Actually, I recommend you to play it, download the PSX emulator and the game rom as it is not available otherwise. Very enjoyable.

I think I could add two collision boxes front left and front right - if either of them detects the ground it means Iā€™m not on top of geometry and I canā€™t roll down.

As for the rotation of the texture/mesh of the ball as it moves;
In a situation where the ball rotates horizontally with the horizontal rotation of the camera, this movement seems unnatural and systematic. We do not control the robot, but a funny ball that seems real.
Take a look at what it looks like in Kula World in slow motion. It looks like this;
ezgif.com-gif-maker(2)
Itā€™s as if we pushed the ball, walked over to it from the other side, and pushed it again.
Then the whole is more organic and friendly to reception.

And I have no idea how to do it, Iā€™ve been struggling with it for days.
I think maybe to add two components in the form of rings that would move selfforward as the actor moves forward. The camera would check which ring is currently in front of it, then that ring would take over parenting over the texture/mesh of the ball, and it would turndown it in the direction in which the ring was rotating.
kularing

Although the whole thing would probably go broke if the actor were upside down?

Also when I put AddLocalRotation here, itā€™s lasts a second, as long as the timeline, however, I set the timeline key to 0.5 second, so now the rotation takes longer than the movement. Why canā€™t the timeline be shortened below a second?

Another problem is when creating a jump.

I created Linetrace who, after detecting the obstacle, stops the Timeline jump, but it works with a delay and the ball lands in mesh boxes
ballcrash
but perhaps it can be masked with an animation of the ball squeezing

Also have to somehow set a pushoff from the obstacle to exactly such a distance to fall in the middle of the box under us, otherwise it will be dyssynchronization of the location of the ball/ground. Maybe after hit, measurethe distance between the ball and the obstacle and so determine the distance of the pushoff? Or maybe could use snap to grid node while moving the ball to snap to the center of the box?

Yes, itā€™s a whole thing, eh? :slight_smile:

I did play Kula World when it came out actually.

Rather than adding bits here and there, it might be an idea to step back and decide on everything you want before you start coding.

It sounds like youā€™re making a reboot of Kula World. So you need rolling, turning, jumping, areas you canā€™t approach etcā€¦

I plan to keep it simple, add a map editor and release it on pc / phones for free.
Are there any free servers that can store player-created maps who can I connect to in my game?? If successful, it will be just small text files plus a screenshot and a rating system.

By the way, I saw that you released the game on Steam yourself, one of the Myst-like ones, so I highly recommend you Sentinel: descendants in time. Intriguing environmental puzzles, an interesting storyline based on a small sci-fi novel, beautiful views and atmospheric music. In general, all Detalion games had something in them.

Coming back to that unfortunate sphere texture. Finally, after countless hours of trial and error, looking for a solution all over the Internet, I managed to meet the challenge, and as usual, the best solution is the simplest;

It was enough to add a component, letā€™s say an arrow, with Relative Rotation as it is by default. Make this arrow always rotates forwards.
To the navigation script, add the AttachComponentToComponent node (with Keep World settings) linking the Sphere with the arrow. Thus, it ā€œpropelsā€ our Sphere texture forward;

In addition, add AttachComponentToComponent to the sideways camera rotation script, this time linking the Sphere to the component that has Rotation set to Absolute / World.
This is how, when we turn the camera, the Sphere stands and waits, as we move forward, the Sphere follows its rotation with the arrow!

Now just the jump system, generate maps from a text file and ready to go :yum:

Zof was a first attempt, just to see if I could actually finished something and release it. Now Iā€™m working on Z2, but itā€™s gonna be a whileā€¦ ( twiddles thumbs ).

It seems that ā€˜Sentinel: descendants in timeā€™ doesnā€™t exist anymore :grimacing:

Glad to hear you got the ball sorted out :slight_smile: