Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by rd42 · Apr 30, 2010 at 04:12 PM · physicsiphoneprojectile

Vector3 and power

How does the vector 3 statement translate to a force? The following code launches a projectile and it does succumb to gravity. I would like to be specific about the mass, angle and force applied, and the let unity do the rest :). Am I on the right path? Thanks for any comments.

var myCounter = 0;

function FixedUpdate () { // Apply force for 15 somethings while ( myCounter < 15) { var power: Vector3 = Vector3(0,25000,25000); rigidbody.AddForce(power, ForceMode.Force); myCounter++; } }

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 e-bonneville · Apr 30, 2010 at 05:51 PM 1
Share

Please consider reformatting your code by selecting it and pressing the button that looks like a bunch of 0's - you'll be more likely to get help.

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by spinaljack · May 01, 2010 at 09:28 AM

The length of the vector is what you want.

You can calculate the angle between the forward vector and your target vector with this

If you want to specify the direction of the vector and then apply a specific length first you find the normalised vector (unit length) and then simply multiply by the power you want

If you want to enter a specific angle you can set the rotation to be horizontal and then use the rotate function to tilt the angle up

Comment
Add comment · Show 2 · 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 rd42 · May 17, 2010 at 01:41 PM 0
Share

What's the difference between a forward and target vectory?

avatar image spinaljack · May 17, 2010 at 06:54 PM 1
Share

Forward is the z-axis (x is right, y is up). Target Vector is the direction you want to end up in so if you're using smooth rotate the object will rotate towards the target vector over several frames. (although without context it's hard to know what you're talking about)

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

No one has followed this question yet.

Related Questions

Projectile motion of an arrow after applying force 3 Answers

Make objects easier to select 1 Answer

Can I stop a lerp completely when it gets to 20% of its original value? 3 Answers

Make a cube bounce off four walls 1 Answer

How to 'flick' objects in a 2d game 1 Answer


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