I wrote these codes to move and object to another with constant velocity according to mouse click. But somethings wrong :S . Help me please :)
var GidecekObje : Transform;
var GidecegiNokta : GameObject;
function Update ()
GidecekObje.velocity = 5;
GidecekObje.transform.position = GidecegiNokta.transform.position;
Thanks for attention...
Aug 01 '10 at 12:37 PM
Transform doesn't have a velocity variable. Add a rigidbody to the object and access velocity that way. e.g. gameObject.rigidbody.velocity = Vector3.forward*5;
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
Once you sign in you will be able to subscribe for any updates here
Answers and Comments
The best place to ask and answer questions about development with Unity. Check out our FAQ for more information.
To help users post good questions and use the site effectively we have posted a tutorial video. Please check it out.
asked: Aug 01 '10 at 12:37 PM
Seen: 1022 times
Last Updated: Aug 01 '10 at 12:37 PM
Can an instantiated object inherit its parent's velocity?
Rotating Detonator explosions, or giving them a velocity?
Detecting sudden changes in velocity?
Apply force at an angle or transform.rotation
How do I zero out the velocity of an object?
Projectile trajectory velocity and angle instead of force with a rigidbody
play sound when player reaches a certain speed
Detecting how much force is needed to bring a rigidbody's velocity to zero
Rotating emitter direction whilst maintaining particle velocity