|
Hi I was wondering how I can move an object from Point A to Point B and then back to Point A. I want to make a prefab out of this so maybe make this relative to its original point. Thanks, Chris
(comments are locked)
|
|
Use a coroutine that moves from one point to another, inside an infinite loop: Thanks!! Works perfectly.
Apr 04 '10 at 04:58 AM
cmos
How is this done in C#?
Apr 23 '12 at 12:43 PM
reilg
no it done in java script
Mar 18 at 08:06 PM
MRProproduction1
(comments are locked)
|
|
Similar suggestion to Eric5h5's here, but simplified somewhat, making use of Mathf.PingPong, speed is adjustable in the inspector, and you can use an empty gameobject reference to define the location of PointB.
(untested, don't have unity in front of me right now) For this one, I get the error: pointB has not been assigned on this line => transform.position = Vector3.Lerp(pointA, pointB.position, i);
Apr 02 '10 at 06:00 PM
cmos
You need to drag & drop a reference to the object which represents PointB into that variable slot in the inspector.
Apr 02 '10 at 06:29 PM
duck ♦♦
very nice script!
Jun 08 '10 at 02:30 AM
vdizzle
hi... i tried the above script that you posted. However, I noticed that when it reaches point B, it doesnt turn the axis of the object (example, boat). Do you have any idea how should i modify the script?
Mar 15 '11 at 07:47 AM
coco88
(comments are locked)
|
|
For Those who need it written in c# i believe this should work.
(comments are locked)
|
|
Can someone please convert this to C#? I'm having trouble trying to do it myself.
(comments are locked)
|
|
Show example of How can I call this fucntion? function MoveObject (thisTransform : Transform, startPos : Vector3, endPos : Vector3, time : float) (Eric5h5's func.)
(comments are locked)
|
1 2 next page »

Thanks for this, however can someone elaborate on how to set position of PointB?
Ah, Sorry, just worked it out!