Suspension-vs-small angles
I''ve got a suspension modelled with spring(I also made damping), which are tied to the box. All''s perfect when box falls flat on the ground, it bounces a bit and lays still after all. But when you''ve got a small anlge between spring and surface, all goes wrong. Of all forces acting on the spring I consider only the part which''s acting along the line of spring.
So:
^-NORMAL
¦ _->
¦_- - SPRING
Usually you have floor reaction force to stop spring from going through the floor, but when when angle is small, the part which is normal to the surface is also too small to do that. So spring comes through to floor. What''s bad. Anybody enctountered that beofre?
Hi,
I think i know what you mean, I had that problem also once.
As you said, you want to move the spring in its own direction (I guess your talking about a car or something like that)
So if the car is nosediving 45degrees you need to move the wheel up (up = up its own direction) more then if you hit it flat.
this is how i did it
Nice model eah?
G =is ground
WP = Wheels possition (under ground so we need to move it up)
WC = Spring connection.
S = Spring (working direction)
Fd = Distance to move the wheel "if" the spring is 90degrees from the ground right?
PN = Plane Normal (Going up "0, 1, 0")
so how much do we need to push it for the wheel to be placed flat on the ground?
Code:
->
Vector Direction = (WC-WP).Normalize(); // Normalized WP to WC Vector
// Now we know what direction to move it but how long?
float Distance = Fd / cos(ANGLEBETWEEN(PN, Direction));
/*
So if the distance Fd = 10
If the car hits the ground flat the angle is 0 "very close to zero" since Cos(0) = 1 which gives us 10/1 = 10 the distance = Fd right?
Angle in this case should be 45degrees or 0.7*** radians which gives us 10/0.7 = something around 14
so we need to push it harder.
// So now we just need to move the wheels possition "Distance" in the "Direction"
WP += Direction*Distance;
ok, i think this will work, maybe theres 100 ways of doing it better but you get the idea
good luck!
/D
[edited by - Dies_Irae on August 1, 2002 4:26:33 PM]
I think i know what you mean, I had that problem also once.
As you said, you want to move the spring in its own direction (I guess your talking about a car or something like that)
So if the car is nosediving 45degrees you need to move the wheel up (up = up its own direction) more then if you hit it flat.
this is how i did it
WC | / | / |G_____/_________PN /| S/ . / | Fd / .WP_._.|
Nice model eah?

G =is ground
WP = Wheels possition (under ground so we need to move it up)
WC = Spring connection.
S = Spring (working direction)
Fd = Distance to move the wheel "if" the spring is 90degrees from the ground right?
PN = Plane Normal (Going up "0, 1, 0")
so how much do we need to push it for the wheel to be placed flat on the ground?
Code:
->
Vector Direction = (WC-WP).Normalize(); // Normalized WP to WC Vector
// Now we know what direction to move it but how long?
float Distance = Fd / cos(ANGLEBETWEEN(PN, Direction));
/*
So if the distance Fd = 10
If the car hits the ground flat the angle is 0 "very close to zero" since Cos(0) = 1 which gives us 10/1 = 10 the distance = Fd right?
Angle in this case should be 45degrees or 0.7*** radians which gives us 10/0.7 = something around 14
so we need to push it harder.
// So now we just need to move the wheels possition "Distance" in the "Direction"
WP += Direction*Distance;
ok, i think this will work, maybe theres 100 ways of doing it better but you get the idea

good luck!
/D
[edited by - Dies_Irae on August 1, 2002 4:26:33 PM]
Swedish: #Gamedev.se on EFNET
Thnx a lot, I gonna try it. As I understood, it''s the way to avoid penetration.
Also wanted to discuss the main idea of suspension:
I stored an array of vertices and checked them for collisions. Whenever I had one, I changed the velocity of the point of a spring which collided. To keep vertices where they had to stay, I used only that part of their velocity that was along the line of spring to change their position.
v1\ /s2
\ /
\/
s1
Here S:=(s2-s1) is a spring vector; to get part of velocity that acts along it I:
Nomalize(S);-normalize spring vector to get direction
n:=(S)*v1; - dot product
S*n;- here we are;
Is that right? They still get out of control sometimes and start bouncing around
I stored an array of vertices and checked them for collisions. Whenever I had one, I changed the velocity of the point of a spring which collided. To keep vertices where they had to stay, I used only that part of their velocity that was along the line of spring to change their position.
v1\ /s2
\ /
\/
s1
Here S:=(s2-s1) is a spring vector; to get part of velocity that acts along it I:
Nomalize(S);-normalize spring vector to get direction
n:=(S)*v1; - dot product
S*n;- here we are;
Is that right? They still get out of control sometimes and start bouncing around
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement