Replicate physics of a car when it runs over oil on a road or track

Hi 

I’m trying to replicate when a car runs over oil on a race track/road - i.e. would make the car spin/wobble out of control for a moment of time but I don’t need to the car to slow down much or at all - more just replicate being out of control slightly.

I’ve tried random settings with Angular and Linear Damping but nothing really does it - I although may have the values wrong.

The car is dynamic object and I’ve set the oil object to static.

Any ideas what I might be doing wrong?

Cheers

Matt

What perspective?  

  • side

  • top down?  (My assumption is you mean this)

  • other?

also, consider packaging up a zip of an example and sharing it.  That way we can see what you’re trying.

Example of top-down:

Dust-Racing-2D_2.jpg

Hi

Top down just like the screenshot. Not by my machine at the moment but yes very similar to the above.

Cheers
Matt

Hi

Parts of the code 

oil start ------------

assets[‘oil’]={

file = ‘oil.png’,

name = ‘oil’,

class = ‘’,

anchorX = 0.5,

anchorY = 0.5,

width = 170,

height = 105,

frame = 0,

spriteSheetName = ‘’,

frameCount = 0,

sequenceData = {},

sequenceInfo = {default = ‘Sequence0’, play= true },

physics = { isEnabled = true, source = ‘Asset’,

bodyType  = ‘static’,

isFixedRotation = true,

isSleepingAllowed = false,

isSensor = true,

isBullet = false,

shapes = {

{bodyShape = ‘Round’,

shape     = {},

bounce    = 0,

friction  = 0,

density   = 1,

radius    = 0,

categoryBits = 0,

maskBits  = 0,

groupIndex = 0},

}

oil finish ----

car start ----

assets[‘car_png’]={

file = ‘car.png’,

name = ‘car_png’,

class = ‘’,

anchorX = 0.5,

anchorY = 0.5,

width = 64,

height = 128,

frame = 0,

spriteSheetName = ‘’,

frameCount = 0,

sequenceData = {},

sequenceInfo = {default = ‘’, play= false },

physics = { isEnabled = true, source = ‘Asset’,

bodyType  = ‘dynamic’,

isFixedRotation = false,

isSleepingAllowed = true,

isSensor = false,

isBullet = false,

shapes = {

{bodyShape = ‘Polygon’,

shape     = {-1,-63,19,-56,25,-32,25,49,2,58,-26,49,-27,-33,-21,-55},

bounce    = 0.1,

friction  = 1,

density   = 1,

radius    = 0,

car finish — 

  1.  I’m not ignoring this post, but I don’t have a good answer right now.  The issue is one needs to vastly simplify a very complex system into something …well simple and manageable.   This is hard to do and even harder to describe simply.

I have ideas but they are all complicated.  So, I’m cogitating when I have time and hoping someone else has played with this before and is willing to share.

2. Thanks for posting some code, but please format code posts in the future to make them more easily read.  No big deal this time, but it helps anyone trying to read the code.

formatyourcode.jpg

Cheers,

Ed (aka The Roaming Gamer)

Hi Ed

Will one of your plugins/apps you sell help me achieve it or at least start me on the right path?

Cheers
Matt

All the ideas I’ve entertained so far involve some degree of 2D math, so my 2D math plugin would apply in this case.

There is a free and paid version (paid version has more features and is faster).  See paid docs for link to free version.

http://roaminggamer.github.io/RGDocs/pages/Plugins/math2d/

What perspective?  

  • side

  • top down?  (My assumption is you mean this)

  • other?

also, consider packaging up a zip of an example and sharing it.  That way we can see what you’re trying.

Example of top-down:

Dust-Racing-2D_2.jpg

Hi

Top down just like the screenshot. Not by my machine at the moment but yes very similar to the above.

Cheers
Matt

Hi

Parts of the code 

oil start ------------

assets[‘oil’]={

file = ‘oil.png’,

name = ‘oil’,

class = ‘’,

anchorX = 0.5,

anchorY = 0.5,

width = 170,

height = 105,

frame = 0,

spriteSheetName = ‘’,

frameCount = 0,

sequenceData = {},

sequenceInfo = {default = ‘Sequence0’, play= true },

physics = { isEnabled = true, source = ‘Asset’,

bodyType  = ‘static’,

isFixedRotation = true,

isSleepingAllowed = false,

isSensor = true,

isBullet = false,

shapes = {

{bodyShape = ‘Round’,

shape     = {},

bounce    = 0,

friction  = 0,

density   = 1,

radius    = 0,

categoryBits = 0,

maskBits  = 0,

groupIndex = 0},

}

oil finish ----

car start ----

assets[‘car_png’]={

file = ‘car.png’,

name = ‘car_png’,

class = ‘’,

anchorX = 0.5,

anchorY = 0.5,

width = 64,

height = 128,

frame = 0,

spriteSheetName = ‘’,

frameCount = 0,

sequenceData = {},

sequenceInfo = {default = ‘’, play= false },

physics = { isEnabled = true, source = ‘Asset’,

bodyType  = ‘dynamic’,

isFixedRotation = false,

isSleepingAllowed = true,

isSensor = false,

isBullet = false,

shapes = {

{bodyShape = ‘Polygon’,

shape     = {-1,-63,19,-56,25,-32,25,49,2,58,-26,49,-27,-33,-21,-55},

bounce    = 0.1,

friction  = 1,

density   = 1,

radius    = 0,

car finish — 

  1.  I’m not ignoring this post, but I don’t have a good answer right now.  The issue is one needs to vastly simplify a very complex system into something …well simple and manageable.   This is hard to do and even harder to describe simply.

I have ideas but they are all complicated.  So, I’m cogitating when I have time and hoping someone else has played with this before and is willing to share.

2. Thanks for posting some code, but please format code posts in the future to make them more easily read.  No big deal this time, but it helps anyone trying to read the code.

formatyourcode.jpg

Cheers,

Ed (aka The Roaming Gamer)

Hi Ed

Will one of your plugins/apps you sell help me achieve it or at least start me on the right path?

Cheers
Matt

All the ideas I’ve entertained so far involve some degree of 2D math, so my 2D math plugin would apply in this case.

There is a free and paid version (paid version has more features and is faster).  See paid docs for link to free version.

http://roaminggamer.github.io/RGDocs/pages/Plugins/math2d/