x


Invisible barrier transform.Translate error

I'm trying to add invisible barriers to my game, what I've done is made a cube, turned off mesh rendering, and added a box collider. with it added and positioned correctly, I can still move straight through it. Any idea why this is? i saw that it could be a problem with using transform.Translate, so I'm not really sure what to do to fix it.

more ▼

asked Feb 10 '12 at 04:42 PM

msd1994 gravatar image

msd1994
16 2 2 2

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

1 answer: sort newest

Translate won't care for anything physic. You need a character controller with character motor (it's a script already attache to the prefab usually), or you need to detect the collision by script, then adjust your position. In that case, the collision event will be raised if your character's collider have a kinematic rigidbody and if the box have a non-kinematic one.

more ▼

answered Feb 10 '12 at 05:24 PM

Berenger gravatar image

Berenger
11.2k 12 19 54

(comments are locked)
10|3000 characters needed characters left
Your answer
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:

x2582
x128
x86
x44
x5

asked: Feb 10 '12 at 04:42 PM

Seen: 522 times

Last Updated: Feb 10 '12 at 05:24 PM