Hello! I have this problem that i can’t make my character aim where i want because the pitch value (y) changes depending on where I am on the planet so when move my mouse on certain parts of the maps it’s like i have inverted mouse or when I move left or right it goes up and down. Please help!
PD: Sorry for the mess!
Since you rotate your character’s mesh according to the gravity, you can get it’s right vector and plug that into an add local rotation node, then plug your camera to the object pin of the same node
HI! Thank you for answering!
Something like this? And do I have to change the values on the AO or the ABP? I can’t really understand well, if you can show me on a photo I would really aprecciate it, if you can’t it’s ok.
Since you asked so nicely I will launch my PC just for you and I actually guessed what you should do so I wasn’t also completely sure, so I will also test it myself before replying back. But gimme some time
Thank you so much! I will wait patiently for your reply
Hey sorry for the wait, setting up my workspace and PC was a little inconvenient given my current situation, that was also the reason why took some motivation to do that but before I start my testings, I wanned to clear some stuff up. I assume your camera doesn’t rotate with the gravity, right?
Also, you can handle aiming with a lot of different ways for example this is one of the ways I use:
The result is then plugged into the end pin of a line trace after being adjusted with a multiplier and having the weapon’s location in addition. The get right vector at the top left is the rotation value of my weapon. I came up with this myself so maybe there are better ways but it’s not too complicated and most importantly, it works
But if you have a top down character and you need the camera that doesn’t rotate around it’s x axis (meaning it’s rotation doesn’t get affected by the gravity) to determine where to aim, I’m working on it rn
No problem! ■■■■ I really aprecciate you took the time to help me, you are the best man!
Now answering your question I don’t think the camera rotates with the mouse, I am using the default BP of the thirdpersoncharacter for the movement of the mouse and keyword.
Now asking about the photo: The get right vector is connected to the mesh right? And I have to replace this that you send me for this right? (I will send the othe photo on other message because i can’t upload two).
Ohhh I think I get what’s going on. I thought it was a top down since you were trying to get the aiming dependent on the camera, but after you mentioned that it’s just the third person I now imagine that you also don’t rotate the camera with the gravity. I thought it was a necessity to calculate it with the camera that’s why that came to my mind. In that case, my example should also work for you. Yeah you can definetly try implementing that.
I think you meant it doesn’t get aligned to the gravity accordingly by rotating around it’s x axis. It should rotate on it’s y and z axis though.
Yes to the weapon, character also works though since it probably holds the weapon straight.
You actually did already have that actor location plugged both into the start pin of the line trace and also the addition pin there. Is it because of that? Meanwhile I’ll also try to figure out
I have to unplug the add and the multiply and connect it again? They where on the previous nodes i had. Also i have nothing connected on the start of the line trace
No just add that get actor location node just like how you did in the post I’m replyig to here
Also plug that into that addition node
Anyways if still not, I’m also trying to recreate the situation
Thank you for your time man!
In case You need here are the movement inputs I had to put for the gravity and the gravity node.
Thanks for those I was also trying to add a planet like shape to test that gravity feature. This thing that I’ve already set up (which we also implemented to you) should have worked in theory but let’s see what I find while testing. You know my initial plan was actually simpler, just rotating the direction of the camera y axis result without rotating the camera itself but I’m curious on why this didn’t work. We’ll see in a few moments hopefully
Hey, just want to make sure I understood your objective right. You have some parts in your map that make the player’s up vector rotate, like walking on walls type of thing right? Gravity is not pulling us directly down everywhere? And you have a line trace that starts from the player and ends somewhere further, which represents the trajectory of the projectile your weapon will fire. Are these correct?
So my aiming mechanic works perfectly after I added a sphere that I can walk on it’s surface like it’s a small planet without doing anything extra. I have some possible causes in mind on why it’s not working for you, but to progress step by step, can you do the following:
Get the mesh and drag out a “Get Socket Tranform” node out of it, set the transform space inside that node to be RTS world and plug it’s return value rotation into our “Get Right Vector” node. The rest is the same. Also a screen recording could be helpful if that doesn’t work