Question by
nexieprado · Jan 05, 2017 at 07:19 PM ·
collisiontriggerposition
Change position in OnTriggerEnter2D
Hello.
I have a code:
void OnTriggerStay2D(Collider2D c) { this.transform.position = new Vector3(Mathf.max(Mathf.min(transform.position.x,6),-6),transform.position.y,transform.position.z); vx = -vx; }
But it doesn't work - position doesn't change.
Comment
ok, is position.x grater than 6 or smaller than -6?
Your answer
Follow this Question
Related Questions
OnCollisionEnter/OnControllerColliderHit/onTriggerEnter Won't work as teleporter? 0 Answers
Unity 2D sorting item by color 0 Answers
Collision issue, Plz help 1 Answer
[SOLVED] OnTriggerEnter doesn't work? 1 Answer
2D: Destroy object with dynamic collider after exiting object with static collider 1 Answer