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 vivalarosa · Nov 05, 2011 at 12:01 AM · physicsrigidbodyforce

Simple Rigidbody / force question

This seems to be something that would be used in a lot of games, but I can't find an answer to this.

What I want to do:

My player will contanstantly be hit by spheres, as she is hit with a sphere I wish to add force relative to the direction the sphere was heading and depending on where the player was hit.

For example if the player was hit on the left side by a sphere heading in the X direction, I would want the player to fly off in the x direction, with some z direction because she wasn't hit in the center, she was hit on the side. If she was hit in the center she would head directly in the x direction.

I cant seem to add a picture, heres a link. I hope it helps. http://imageshack.us/photo/my-images/444/forceq.jpg/

The only solutions i've encountered is to add a physic material to the player, such as Bouncy, and give the spheres great mass. However I cannot do this in my game because it is networked.

Thanks in advance!

Comment
Add comment · Show 2
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 aldonaletto · Nov 05, 2011 at 12:33 AM 0
Share

Is your player a rigidbody or a CharacterController?

avatar image vivalarosa · Nov 05, 2011 at 05:42 AM 0
Share

Rigidbody

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by kevork · Nov 05, 2011 at 06:34 AM

The simplest way would be to use Rigidbody.AddExplosionForce when you detect the collision, otherwise you can use Rigidbody.AddForce.

Comment
Add comment · 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
0

Answer by vivalarosa · Nov 05, 2011 at 09:47 AM

Thanks, i know how to add the forces but i need to add the forces depending on where the player was hit. I presume it has something to do with adding collision from the collision point in the same velocity that the object was heading - an offset accounting for where in the rigidbody it was hit.

Comment
Add comment · 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
0

Answer by vivalarosa · Nov 14, 2011 at 12:21 AM

Does anyone know how to do this? As mentioned it would seem like a pretty common thing. Another example would be a player being hit by a car, you'd want the player to be pushed in the direction the car hit you and if you were hit on the side, you'd fly off to the side a bit.

Comment
Add comment · 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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Character Controller meets Rigidbody 1 Answer

add force to object that has 2 different rigid bodies 0 Answers

How to apply uni-directional force to a rigidbody 0 Answers

Parenting not working with massive force to rigidbody. Does having rigidbody on child screw things up? 1 Answer

chain and 3rd person character 0 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