I am working in a game engine on basic suspension using springs. I have nothing further than high school physics, so excuse the question is its basic. I am learning.
For example, a motorbike is a rigidbody with a 100kg mass. The game engine applies gravity to this 100kg "box". Each spring shoots out a ray from the top of the spring down in the direction the spring is pointing. When this ray hits a surface (the road), the spring's length is calculated as its simply a wheel radius from the road to the attachment point.
Using Hooks Law, F = k.x, and subtracting damping based on the velocity of the spring's length change, I can then apply this force to the rigidbody at the contact point in the opposite direction of the spring. This worked really well for cars on level road. Even when a car is turned vertically and fired at a wall, it seems to pretty believable, the springs react as expected.
The problem is when the springs are at an angle.
Applying the spring forces in the spring direction would cause a net force to make the bike accelerate backwards in this case. Obviously this is wrong. As the front fork angle is increased it becomes more obvious.
When the front fork is at 90 degrees (pointing straight forward) the spring should play no role. So if the bike is dropped, there should be no spring. Instead I can calculate a force to cancel the vertical velocity of the wheel. This stops it from "falling" through the road. If you can imagine driving this weird bike into a wall, the one force would keep the wheel from going through the road, and a second would bounce it back from the wall. In this case the spring force is once again applied in the direction of the spring.
I think I have gotten myself into a brain loop and just cannot break out of it. Maybe if somebody can just explain what forces are acting on the rigidbody when the wheels are on a surface and how the spring's angle plays a role. I am sure the surface's orientation in regards to the springs' plays a massive role.