Jump to content

Touching but not coliding


MikeW
 Share

Recommended Posts

Ok I am wanting to put a material on the ground that when my car hits it it's slowed a little and when the zombie hit is they are slowed alot (and such a material exists non newtonian fluids). What do I need to tell my object so I can see if they are touching without having them bounce off everything. 

Link to comment
Share on other sites

What kind of physique are you using, this is platformer are you using tilemap?

When i read this i have two contradiction ideas about what you want:

1. you want your terrain on top of which units are moving to influence their properties

2. you want some area to behave like Newtonian fluid, and im not sure if you know what it means in real life (like if object isnt moving it sinks into that material and when its moving it can push itself from it)

Link to comment
Share on other sites

I am using P2

 

and option 2 some area behaves like a non newtonian liquid so if something moves fast it will stay hard, something moving slow will sink in. Baiscally I drop a sprite out of the back of the car (goo dropper) and if a zombie walks over it it moves slower, and the goo does not move if something hits it., (And thanks)

Link to comment
Share on other sites

Basic idea create areas for nonNewtonian fluid material and in update use ordinary arcade physique overlap instead of collision to check what is overlapping and modify unit s body velocity or acceleration

 

game.physics.arcade.overlap(nonNewtonianAreaGroup, unitsGroup, onCollision)

onCollision = function(unit, area) {
// modify unit.body.acceleration.y so when unit.body.velocity is large it gets accelerated upwards 
// or think of something more elaborated for working in any direction
}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...