Hey, so recently I’ve been digging into how I could recreate a camera system shown in this video for my bowling game, and I just can’t get it to be right on the money. To start off, here’s the video of the functionality of the camera in action: https://www.youtube.com/watch?v=vMM0zHU-pwg
What you’ll notice is the camera starts at point A and travels to a final position that is point B. You need to constantly center the camera with your mouse and the ball then launches through the center of the camera when the camera arrives at point B, or the foul line of the lane. But you’ll notice the camera does shift/sway mildly as the camera interpolates to make it harder to throw an accurate shot, it’s not crazy difficult, but it’s just challenging enough to keep the player interested. I really like this mechanic for a bowling game, I think it’s really well done. So well done that I figured it’d be a good mechanic to try to add to my bowling simulator game to add more skill to it. Right now all you do is click to throw the ball…not super good. But yeah, this is the system I’m trying to achieve, but I couldn’t figure out how to get it to work good. I tried using Interpolate with a longer time so the camera appears to be shifting around, but that honestly didn’t look good enough.
Any help or example code here appreciated greatly, pretty sure a mechanic like this would fit my game nicely, atleast, in my mind it does. Would have to see how it really played out if I could truly get a realistic system like in the video going. Thanks for reading!
Not sure if bumping is allowed on these forums, but I’m still trying to figure out where I could start.
All I tried so far was using interpolate and lerp to lerp between the two points, and to focus at the mouse’ position. There needs to be some other sort of math in there for the drifting part of it…it can’t be choppy or too much though, otherwise it’d be impossible to throw the ball where you want to.
As I understand it, the power bar increases until the mouse is clicked, at which point the camera moves forward. Once it moves forward enough, it stops and the ball is launched in the looking direction. The camera may optionally attach to the ball and follow it until a point before it hits the pins.
As the camera is moving forward before the ball launches, the mouse may change x and y coordinates to look side to side or up/down. Each frame (on render stepped) you could add a small offset to this user movement. The offset would be based on a 2D velocity vector, which would change direction and magnitude by a random amount each frame. This will create the effect that frames close together tend to move in the same direction (since the 2D velocity vector only changes so much after each frame) and would seem to wiggle due to the randomness. The minimum and maximum direction and magnitude changes can be fine tuned to get the desired effect and feel.
After the ball launches, the track camera mode moves with a subject but doesn’t rotate with it. This would allow the camera to follow the ball.
The camera position can be read each frame to determine if it is close enough to the stopping plane (look up point to plane distance, it is a simple magnitude of a projection on the plane normal). If a part is slowly moved forward and the camera is set to track it, then you could use another part as a wall and detect collisions. Later once the bowling ball touches an invisible part before the pins, the camera should stop as well.
Thanks for the info Language! Will try implementing this, although not really sure what to do with the 2D velocity vector you were talking about with the interpolation method of the camera, if that makes sense. When you say that, are you just referring to an offset Vector2? If not then I don’t understand how to do this.
Yes, it is an offset applied to the users mouse movement. Once a script it made to turn the camera when a user moves their mouse, the offset vector2 can be applied to their x and y mouse movement every frame. Internally the vector is best represented in polar coordinate form so the magnitude and direction can be easily changed. Then just take the cosine of the angle times the length to find the x coordinate of the vector and the sine of the angle times the length to find the y.