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
0
Question by mengkheang · Jun 08, 2015 at 11:05 AM · 2d2d game2d-physics

want to knock gameobject to the same direction as the projectile

Hello im very new to unity I want to knock the gameobject to the same direction as the projectile but unfortunately i was able to knock it horizontally and vertically. im unable to knock it at angle and also this is a 2d game.

any help is much appreciated!

alt text

untitled-drawing.png (17.1 kB)
Comment
Add comment · Show 3
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 fafase · Jun 08, 2015 at 11:47 AM 0
Share

Do you really want to send the blue ball in the same direction as red ball? That would look unnatural. $$anonymous$$ost likely, if you use rigidbody, you pretty much have nothing to do. You send the red ball and let the engine do the rest.

Though if you are in the case the blue should take the red velocity well I just gave you the answer.

Whatever is the velocity of the red is passed to the blue on collision. If you are translating the red then the vector parameter is the velocity, if you use rigidbody you have teh velocity in

  blue.rigidbody2D.velocity = red.rigidbody2D.velocity; 
avatar image mengkheang · Jun 08, 2015 at 12:19 PM 0
Share

no i mean the red ball shoot projectile to hit the blue ball and knock the blue ball to same as the projectile direction that the red ball shoot but i already try with rigidbody would not knock it to the same direction as the projectile that the red ball shoot or maybe i do sth wrong

avatar image fafase · Jun 08, 2015 at 12:20 PM 0
Share

So your red ball is probably translated with something like:

  transform.Translate(direction * Time.deltaTime);

direction * Time.deltaTime in this case is your velocity.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Notter · Jun 08, 2015 at 11:37 AM

they do something similar to to what you're asking in this video, about half-way. they shoot a bear with a capsule collider, and apply force where the "projectile" hit, and send the bear flying in that direction.

http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/fun-with-lasers

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 mengkheang · Jun 08, 2015 at 12:19 PM 0
Share

Thanks! will look into that

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

2D going through walls bug 1 Answer

How do I stop my sprite from jumping in the air? 1 Answer

How to check if an object hits the ground hard enough then add explosive force around it (2D) 1 Answer

RigidBody2d not detecting collision when dragged 1 Answer

How To Create 2D Ragdoll Movement? 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