playMaker

Author Topic: Simple object collision/bumping stumps me!  (Read 1252 times)

richardh

  • Junior Playmaker
  • **
  • Posts: 97
Simple object collision/bumping stumps me!
« on: March 28, 2018, 07:38:30 PM »
My first tests today have not gone well!

I wanted to create two objects on a plane. These two objects were set to move toward each other (or one was set to move toward the other). When they met I simply wanted them to bump into each other (or the one object to gently knock the other a bit) like dodgems. However, this simple test has shown me that this is NOT as simple as I thought!

Using various combinations of rigid body and settings (isKinematic on/off) I find that either they have to be set to non-rigid body (so no collision) or if they are set to a rigid body they will react violently and unpredictably flying off or dropping through the plane.

What would be the method for setting up two (or more) AI objects to collide and bump into each other gently before rotating away and continuing forward til they bump into another object.. etc. etc?
I need to be able to have a moving AI that can interact with either another AI or a player's object (say a player cube). Bumping and physics need to be active during these interactions (or at least some sort of force acting on each object when they collide.
thanks for help.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Simple object collision/bumping stumps me!
« Reply #1 on: March 29, 2018, 02:45:32 AM »
Hi.
There are a few ways that you can achieve this.

You could play around with the gravity/mass/physics settings and so on...

AND/OR

Create a Physics Material and play around with the bounciness (place in the collider).

OR

Have a larger collider on the ai and set as trigger, then 'animate' the bump.

or instead of a trigger you could use a raycast

Physics material might be the best option.