Sign in to follow this  
MikeW

Touching but not coliding

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. 

Share this post


Link to post
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)

Share this post


Link to post
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)

Share this post


Link to post
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
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.