In search for a better way to control the race cars in top down racers i found this solution.
Its basicly a cam that is fixed to the players car, but moves around the car in the opposite direction of where u are steering at.
The cam does look at the angle of the car but through its motion it ads a swiping motion to the screen.
Normal scrolling in topdown racers have you centered on the car.
So u never have that feeling that the car is comming loose of the screen itself.
A little delay would be nice but how right?
With this method u are in control of the cam, and probably are going to ad some more features to it that i havent even considered yet.
Its a basic template.
How it works.
A: The Yellow rectangle represents the car.
B: The Cam represents the cam.
C: And the green arrow represents the target angle of the cam.
Also in this image we can see 2 times a purple (+) and 2 times a purple (-).
These represent the direction of movement.
This setup moves in opposite directions.
So if we would say that the car turns right?
Thats correct, it would point its nose to the (-) side.
What we now see is that the (-) side of the cam moves towards the (-) side of the cars (-) side.
So in general the 2 minussus and plusses are traveling towards each other.
The role of the green target arrow is as followes.
The Target angle moves with the cam in a little lower rate then the car moves.
Because in this setup the cam cant look in the same direction that the car does we need the green arrow to do that part.
Thats why the scrolling will be set to the green arrow and not directly to the cam.
U can look at the green arrow as the lens, allways looking towards the target.
But the arrows body, "which is the cam" can move around the car.
This is what creates the difference in scrolling feel.
U steer right and the cam gives u the sensation of focussing attention to the curve ahead of u.
Lets build it!
Make shure the sprites are all pointing in the same direction in the editor.
On the car we can see the red x.
This is the ImagePoint(0) of the cam.
The cam is a little off centre so when we are going to alter its angle it automaticly spins around.
There is also a second imagepoint for the cam, this way u can possition the green target angle arrow to the "image center" of the cam sprite, and not the off center one thats on the car
In the overview picture above, there is on top of the Cam another red x.
This one is the ImagePoint(0) of the target arrow.
It is set at the base of the arrow so when we alter its angle it points into directions correctly.
The Green target arrow also needs a second imagepoint.
This is the one we wil actualy set the scroll to.
As u can see, this one is way ahead of the arrow itself.
This ensures us the desired effect we need.
But as with all things in life, do experiment, and especially with this image point.
Now we make 2 variables
Then its time to set the rate at which the (-) of the cam travels towards the (-) of the car at about 0.5 per second.
And so on for the +
The system switch events can be used to set this cam offline
Next we do the positioning of the sprites.
And add the scrolling and angle actions.
The action with (sprite 0) is not needed
And we set the angle for the Target.
Thats all for the cam part.
So whats next?
Good handling = control
For this to work correctly we need to add some juice to the cars behaviour.
We'l add gears and steering speed changes.
First the gears.
Set them up as the image bellow shows us.
*Dont forget to alter the max speed of the car to 1300 if u are planning on a 4000 x 4000 race cirquit.
U can do otherwise but the handling discribed here is set to that parameter.*
Then the steering speed.
You are ready!
I build a little demo to show u the result of this carcamsystem.
CarCam vs Normal scroll Demo
And Here u can download the Capx
If u would set a variable to a slider and calculate a ratio.
Then u can set the gears and steering speeds to (xxx)+Ratio.
So when u then use the slider, all the gear and steering settings change but stay alligned to eachother.
A demo for this can be found at Future Racing Demo