I’m trying to create a grinding system similar to THPS. I need to make the character rotate perpendicularly to the spline that controls the grind. While I’ve been able to get the character to sort of do this, sometimes it will reverse directions instantly after too much rotation. I assume I need to use quaternions somehow, but I don’t understand them at all. What do I need to do to fix this?
If the spline wraps back on itself ( like a roller coaster loop ), no chance, because of a bug ( I think ) with the way the editor handles splines.
If that point is covered, you can do it no problem but, you can’t split open rotators and fiddle with them Rotation is a strange thing and the rotator nodes know how to handle it. You need to code it only using ‘add rotator’ nodes.
Tell me if you need a bit more info, but can’t give an example rn.
Basically, this will make the character face perpendicular to the grind rail. Return Value 1 is the movement vector and Return Value 2 is the perpendicular angle. It works fine without the Rinterp, but doens’t look very good as it snaps instantly. Rinterp will cause the character to spin in circles on the rail if the interp speed is low, and kind of just sit at an angle if the speed is high.
Yes, sorry the image is a little low resolution, it’s actually 180deg.
So I was trying to make the character face perpendicular to the rail that they grind on. That’s not that hard using the Get Right Vector node from the spline, but it means that the character will always face the Spine’s right vector. So if I want him to face the opposite direction, like would happen if he approached the rail from it’s right vector, I have to get the opposite of his right vector.
Yes, the character rotates constantly when the interp speed is low. I’m basically just trying to smooth the transition between his rotation when he’s off the rail to his rotation when he’s on the rail.
If you want to switch things around, get in there early on. Instead of just taking the right vector, just take the right vector and multiply it by -1. Then you don’t need the math.
Also, instead of just ‘make rot from X’, you can try one of these nodes
You get to take rotation from the spline, and specify a vector from your player. In this case, you probably want the spline vector first, because it has priority. Player forward vector might be a good starting point.
The nodes with 2 axis like ‘make rot from XY’ are saying 'I will take the X vector you give me as the main orientation, but will try to also correct as much as I can using the Y one also.
So here
you can use, for example, ‘make rot from ZX’. Give it the Z ( up vector ) from the spline ( main thing you want ) + ‘get actor forward vector’ from your character ( the way your character is facing ).
Best of both worlds So, in your character you would say