Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Wheels and slopes in 2D  (Read 1276 times)

0 Members and 1 Guest are viewing this topic.
Wheels and slopes in 2D
« on: October 04, 2010, 04:09:02 am »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 446
For my own benefit, I wanted to talk this one out. But hopefully it helps other people too.

   
Fig.1, abc - A single wheel.

Here's one wheel heading towards a slope, pretty simple. If it's going very fast (1b), it treats the edge like a platform. The wheel will get air for a bit, and depending on its horizontal speed and its mass, as well as the angle of the slope, it will either clear the slope entirely, or fall onto the slope's surface. When it lands, depending on the game physics, it should either bounce, or continue rolling until it stops.

If the wheel is going slowly instead (1c), it will have little to no airtime when it reaches the edge. It rolls off the edge and immediately down the slope. It accelerates due to gravity as it rolls down the slope, until it reaches the bottom and begins to slow down.




   
Fig.2, abc - Bike trouble.

A bicycle behaves similarly to a single wheel, but by adding extra wheels you start to run into a spriting problem. When a vehicle with a rigid body rolls slowly over the slope's edge, spriting can be awkward. 2b shows how the problem can be avoided with a bicycle, if the slope is angled even as much as 45 degrees - the sprite can be rotated so that it appears to be traversing the edge.

With a more awkward angle (2c) the problem is a little more difficult. A visual solution here has us consider the biker, who must remain safely on top of the bike. The bike stops with the back tire reaching the edge, and the sprite pivots downwards (with the back tire as the pivot point) until the front tire touches the slope. The biker could then safely descend.



For longer objects, the effect is similar. A school bus, for example, drives off the edge. When its back wheel lands on the slope, it pivots on its back wheel until both wheels are against the slope of the surface. Realistically, this isn't very safe for the people inside, but visually it works.
« Last Edit: October 04, 2010, 04:17:21 am by Nabeshin »
Logged
Re: Wheels and slopes in 2D
« Reply #1 on: October 04, 2010, 05:20:18 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
It is all about calculating resulting forces. When you are coming at a steep slope and you go to slow then the front wheel will decent the slope. Thus the underside of the bike will hit the edge. In this case a bus and the like would get stuck and the biker would flip over. With bikes and cars, you would need to calculate the forces on both wheels to see if it would pivot. Or have a look up table with speeds and slope angles.
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.385 seconds with 41 queries.

anything