Hello everyone, im having problems with interp:
INTRO:
“Current actor Y Degrees” Gives me the actor degrees on the Y axis (0-360 degrees)
“Target Y Degrees” Gives the mouse vector degrees on the Y axis (0-360 degrees)
They both work fine.
PROBLEM:
When I interpolate, the interp never reaches the target degrees…, I tried every interp vinterp finterp rinterp, all was the same, I heard you have to re-feed the current degree? or something like that.
INFO:
-TARGET IS ALWAYS CHANGING
-CURRENT IS ALWAYS CHANGING
looks like im running into a gimbal lock problem, which I don’t know how to solve yet, it looks I have to use quaternions but cant find anyplace in the whole internet about how to use them…
You are only rotating 1 axis, gimble lock by definition is not possible.
IMO this is your problem:
you need to project the mouse position to intersect the plane your actors are in. As it is, the mouse position is in a small area in front of the camera component.
hey pezzott1, thank you very much, however, this is how i set this up, given your instructions, maybe I did it wrong, but still not working, I am thinking right now, that maybe this problem happens only on a wall (2d game) and not on a floor (topdown game), because its the pitch that has the problem, maybe you can share your blueprints? you are so kind giving such a full explanation, you are really helping me out, and your expertise shows, thank you again for your time!
For Line Start got World Location of the mouse is the mouse position in 3D, you need to take the direction vector and multiply it so it intersects with the plane your actors are at. I did * 5,000 to exagerate but you are free to test for Line End as long as it touches the plane.
The Plane Origin is the location of the plane: could be ( 0, 0, 0 ) or where ever yours is in world space.
For the Plane normal I used the Up Vector ( 0 , 0, 1 ) in my case. Since you are looking to the horizon (your game is on a “wall”), think it’s ( 0, 1, 0 ) for you.
I saved it to a variable because I’m reusing it a few times every frame.
So for the different type of rotations:
The basic look at: Used Yaw since I’m top down, you should use Pitch.
Hello again! Pezzottl, interp works, however, it’s still affected by this weird “gimbal lock”, I’m sure pitch is a different story, here is a gif showing the weird rotation, I’m sure this can be fixed, at least movement is solved, so thank you so much, and also the more elaborate way to do it, I was needing that for later anyway so I’m going to sit read understand and then implement it!.
This is the first part of the code
in this part, we get the line that intersects with the plane (i left the debug sphere too) (gif too low q)
the second part
now we just findlookat actor location vector to the intersect vector, and we interpolate.
i tried using set actor rotation but it was worse, the player didn’t even rotate past 90 degrees, which broke the movement , which add force to the forward vector ;
(i tried to copy you as much as i can so its easier for you to read)
and this is the behavior
If you are going to set it to a variable, use the variable for everything else. What ever you connect directly to the intersect node gets calculated again needlesly.
Think this clipping has to do with the sprite fighting with the background to render on top (z fighting). Try separating the plane in Y a bit.
I don’t know why it moves down like that, but doubt it’s the rotation. Imo has to do with how you are moving the plane.
With respect to the variable, yeah I was not going to set it, but afterward, i did and forgot, i will fix that.
To the problem, even when stationary, and the background really far from the plane, it does rotate the same weird way, even with another way of moving the plane it still does, pitch is naturally limited to 90 degrees, even on 2d, i don’t know why.
and yeah the plane falls because it has low speed and high angle of attack, that’s why it moves down and it simulates a stall, but don’t let it distract you, thanks again for your help!
hey pezzottl, there is no case in trying to remove this lock, I’m moving everything on the ground, at least now we both (and future readers), that if you plan on making a flying game 2D it better be a top down one, side scroller is really hard, i really liked your help, and i hope i can give that favour back in the future!,
Note: on the ground it does work, here is an update: