Make an Object Responding to Physics

Hi all,
I have been using the code below to make my character jump in a curve from one point to another.
Found it somewhere in this site.

function Update()
{

BezierTime = BezierTime + Time.deltaTime;

if (BezierTime >= 1)
{
    BezierTime = 0;
}

CurveX = (((1-BezierTime)*(1-BezierTime)) * StartPointX) + (2 * BezierTime * (1 - BezierTime) * ControlPointX) + ((BezierTime * BezierTime) * EndPointX);
CurveY = (((1-BezierTime)*(1-BezierTime)) * StartPointY) + (2 * BezierTime * (1 - BezierTime) * ControlPointY) + ((BezierTime * BezierTime) * EndPointY);
transform.position = Vector3(CurveX, CurveY, 0);

}

The code works perfectly, but what I want to achieve is make the object tp bounce (responds to physics) when it hits something.

Any suggestion please?

Thanks very much.
[sorry for my bad english.]

Irina Popova

Well you could try a mixed solution. Attach a Rigidbody to your object, but make it kinematic, so the physics are disabled. Move it along the bezier curve, but you need a way to interrrupt the movement (e.g. a boolean variable). Just check for collisions with OnCollisionEnter. If you collide with something, stop your bezier movement, turn physics back on (isKinematic = false) and apply a starting force maybe just in the old movement direction.

From now on your player will react to physics. You have to find out when your player is back on ground to switch back to your old movement, but that’s roughly the procedure.