- Home /
force traslation
how can I force a movement transform.translate? I have a scene with an enemy that goes back and forth. I used Mathf.pingpong to bring you back. I want to make sure that every time you collide with something Invert its translation but is forced into Update. How can I do?
How are you detecting collisions? Can you post your translation code?
You should not post follow up information as an "Answer." By doing so, your question is now marked as having an answer and therefore is is less likely that you will get additional answers. You can convert your answer to a comment using the "more" dropdown.
Your translation code won't do what you want, plus I don't see the $$anonymous$$athf.PingPoint().
Unity has a couple of different ways it handles motion. Directly assigning the transform is one of them, but you give up "automated" collision detection. So if you are going to create motion this way, I need to understand how you are going to do the detection. If you have not yet figure than out. You might want to spend some time exploring the Rigidbody component.
Answer by Bolt · Mar 31, 2013 at 05:42 PM
do{
transform.position.x +=0.2;
}
while(transform.position.x >=100);