# Simple Rigidbody / force question

 0 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! more ▼ asked Nov 05 '11 at 12:01 AM vivalarosa 106 ● 10 ● 10 ● 12 Is your player a rigidbody or a CharacterController? Nov 05 '11 at 12:33 AM aldonaletto Rigidbody Nov 05 '11 at 05:42 AM vivalarosa add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

3 answers: sort voted first
 0 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. more ▼ answered Nov 14 '11 at 12:21 AM vivalarosa 106 ● 10 ● 10 ● 12 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 The simplest way would be to use Rigidbody.AddExplosionForce when you detect the collision, otherwise you can use Rigidbody.AddForce. more ▼ answered Nov 05 '11 at 06:34 AM kevork 415 ● 1 ● 2 ● 4 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
 0 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. more ▼ answered Nov 05 '11 at 09:47 AM vivalarosa 106 ● 10 ● 10 ● 12 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users
Your answer

### Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1877
x1793
x292

asked: Nov 05 '11 at 12:01 AM

Seen: 918 times

Last Updated: Nov 14 '11 at 12:21 AM