I’m working with unreal’s rollerball template trying to make a movement mechanism similar to Marble Blast or even the third person template. I achieved mouse look on the template so the player can look around the world but when I move forward in moves according to the forwards direction. So I’m failing to make the player move towards where the mouse is pointing or where the player looks at.
Any help with this would be greatly appreciated as I can find any solutions online.
I’m guessing you are probably missing the direction from mouse? Also, mouse is a 2D point on screen. If you want a point in your game world (even if you are topdown), you need to project that point onto something. Typically you cast a ray into the scene and take the first hit point and tells the player to move there.
So, it looks like you’re using a static world vector to control forward/right input in that first image. Like, forward is always (1,0,0) in world coordinates and right is always (0,1,0). If your intent is to use the mouse cursor to define forward, you’ll have to calculate that direction as the difference between two vectors; ball’s current position and the mouse cursor position in the world.
If you just want to move in the direction that the camera is facing, substitute your vector in “roll left/right” with GetRightVector call on the camera. Also, substitute “roll forwards/backwards” vector with a call to GetForwardVector on the camera.
sorry…without knowing exactly what your project is, i’m just guessing your intent. maybe you want to move in the direction the character is facing? if so, replace those GetForwardVector and GetRightVector calls to reference the character instead of the camera.
Sorry if i didn’t explain it correctly. My project is a 3D platformer, the player (a ball) moves around rolling and jumping and has a third person view.
I’m working in a 3D setting for a third person platformer with a rolling ball. The camera rotates around player as it should but I want the player to always move forward to where he is looking.
When I replace the vectors with the GetForwardVector and GetRightVector for some reason my left and right become my forwards and back and my forwards and back become my left and right. It does work in the sense that it moves forward towards the camera but with that weird input problem. Here’s a screenshot of the BP
seems you want to ‘orient rotation to movement’ however I see your not using a character movement component so this is now more difficult than if you did.
Off the top of my head my solution would be: on your movement events branch on axis value being nearly equal to 0, if true set ‘use controller rotation yaw’ to false, if false set ‘use controller rotation yaw’ to true.
not quite sure why you wouldn’t want to just ‘use controller rotation yaw’ all the time but w/e.