x


Collision,physics and animation problem?

I have this code here:

 private var red_right_left_moved=false;

private var red_left_right_moved=false; private var red_left_right_moved2=false;

private var red_back_front_moved=false;

function Update () {

var screenCenter = new Vector3(0.5F, 0.5F, 0);

var ray = Camera.main.ViewportPointToRay(screenCenter);

var hit : RaycastHit;

//right left 1

if(Input.GetButton("Fire1")&& red_right_left_moved==false){

if (Physics.Raycast (ray, hit, 1000)) {

if(hit.transform.tag=="red_right_left"){

   hit.transform.animation.Play("anim1");

   red_right_left_moved=true;

}

}

}

....etc....

The goal here is that the animated box that i moved should collide with the character controller but it doesn't. It collides after the animation end, but i want to push my character if the box is moving. How can i do that?

more ▼

asked Apr 13 '12 at 12:36 PM

s_aint47 gravatar image

s_aint47
82 6 10 10

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3765
x2482
x1863

asked: Apr 13 '12 at 12:36 PM

Seen: 319 times

Last Updated: Apr 13 '12 at 12:39 PM