I am trying to sync control with camera rotation.
Till now I followed this post
ok. so i have opened up the rolling ball template and played with the code a bit, and ive got a lot of cool things added.
most importantly i have added an option to rotate the camera around the ball so its not a side scroller any more.
but i cant for the life of me figure out how to sync the controls with the camera direction. if i turn my camera to look any direction but forward. the ball will still roll in the same direction despite turning the camera. if i get what i want the ball should ro…
But there is issue.
When we turn camera and look straight down from z axis (Top view), then the left/Right controls doesn’t work.
They only works when viewing from front or side views,
There is some conflict with z axis rotation and I can’t understand how to resolve it. Please help.
When looking straight up or down, your ControlRotation forward vector only has a Z component, ie. (0,0,1) or (0,0,-1), so your end result is basically a zero vector.
I’m not familiar with rolling ball template, but try using character rotation instead or Control Rotation.
NUKETheWay
(Niranjan Wagh)
June 8, 2021, 12:16pm
3
can you please where can I find such function? I am absolute beginner. I tried searching function for “get character rotation” but no result
NUKETheWay
(Niranjan Wagh)
June 8, 2021, 12:19pm
4
Never mind. found it. Its name was “GetBaseRotationOffset”. Thanks Its working now
NUKETheWay
(Niranjan Wagh)
June 8, 2021, 12:26pm
5
Wait. its working but changing camera about z axis does not change the controls.
Means looking from front view works correctly. but From back view pressing left character goes right and pressing right character goes left. It is not based on camera rotation anymore. I guess I have to both of them combined somehow.
NUKETheWay
(Niranjan Wagh)
June 9, 2021, 10:16am
6
Got the solution. It was so stupid.
lets see the issue first if anybody missed it.
Using get control rotation we get the position of our camera.
So viewing from top view was slowing down left/right movement of ball.
Why?
Because Get control rotation was feeding some some roll and pitch value with yaw.
For right/left move we only need to know Yaw. So this solved my problem
Hope this helps somebody!
As a beginner
I was looking for solution since 2-3 days and didn’t realize the solution was in front of me whole time