Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-1
Question by Zels · Feb 09, 2013 at 10:25 PM · gameobjectvelocity

Trying to set velocity to a gameobject without a rigid body

public void Update (float deltaTime) {

             //not really sure what the syntax is to set the velocity
            splash.velocity.Set(0, 0, 0);
 }
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image cdrandin · Feb 09, 2013 at 10:40 PM 0
Share

if you want to set velocity, you need to make your own movement based functionality, since you don't want velocity. You could find the average velocity given your own speeds, but setting it won't really do good unless you have created the implementation similar that of rigidbody component, but more simpler.

3 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by Loius · Feb 10, 2013 at 01:58 AM

Your syntax is whack. You should work your way through at least one official Unity tutorial, it'll answer most basic questions.

 public Vector3 velocity;
 
 public void Update() {
   transform.position += velocity * Time.deltaTime;
 }

This will teleport the object from point to point, which will actually put it inside other objects if they're in the way. There is a HUGE amount of discussion on this topic already, please search if you need to solve that particular issue.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bardackx · Aug 18, 2017 at 11:00 PM 0
Share

I would use this same approach but in the fixedUpdate and using fixedDeltaTime ins$$anonymous$$d of deltaTime, that way is similar to the RigidBody approach in terms of update order asi in this link https://docs.unity3d.com/$$anonymous$$anual/ExecutionOrder.html

avatar image
-1

Answer by Zels · Feb 10, 2013 at 01:33 AM

So how would I go about starting that?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image austinkat · Aug 18, 2017 at 11:05 PM 0
Share

So if you want an object to move in any direction you would have to have a direction for the x, y, and a z if 3d, as well as a speed for that object. So if you wanted it to move you would need something like this.

new Vector3 (target.position.x (multiplied by) speed, target.position.y (multiplied by) speed, 0f); for a 2d game. if its 3d you'd want a z axis as well.

for the speed you can have it set to private if you wanted to initialize it in code or make it public and set it in the inspector.

your target would be an object in the game you want the projectile to move to. or you could just have it as a number if there isn't a target.

Hope this helps!

avatar image
-1

Answer by Zels · Feb 10, 2013 at 01:33 AM

How would I got about doing that?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Loius · Feb 10, 2013 at 01:56 AM 0
Share

This isn't an answer (and neither is the other copy of it).

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Cannot precisly get the Transform(position and rotation) and velocity of the HTC vive controller in Unity 0 Answers

How to get local axis from characterController.velocity 1 Answer

How to make a gamebject wiggle slowly as it moves forward ? 1 Answer

I am trying to code a .velocity but i dont get the option of choosing it. 1 Answer

How I can change the speed of an object with the speed of sound so they are evenly matched? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges