x


how to predict physics trajectory of a sphere

Hey guys

I'm working on a game where I have to throw a bouncing ball on walls. I have some sort of aiming assistance where I simply draw line from the current ball position to the raycast hit position Then using the raycast hit normal, I compute the reflection vector and display another line starting from the hit position and following the reflection vector direction.. Anyway I'm sure you got my point.. This works perfectly, the raycast always returns me correct Hit point & Reflection vector

But on the physics side the ball doesn't follow the same trajectory at all.. I've tried to turn off the gravity.. same issue I've also tried to use a point (instead of a sphere) by using a tiny radius on my sphere collider.. same issue..

Even with a simple case where I throw the ball in the up direction, with a wall at a 45 degrees angle The ball doesn't bounce on a 135 degrees angle like the raycast does but something around 150..

Am I missing something obvious here ??

Thanks a lot for any kind of answers.. I'm really stuck here and don't write to write my own physics engine ;-)

more ▼

asked Jun 02 '11 at 08:50 AM

oxium gravatar image

oxium
181 6 8 10

(comments are locked)
10|3000 characters needed characters left

2 answers: sort oldest

It sounds like you're headed in the right direction you'll just need to tweak the physics settings of your ball to match your raycasting.

For instance you might want to minimise drag and angular drag on the ball, and play with the mass etc.

I hope that helps either that or I'm totally missing what you are trying to do :p

more ▼

answered Jun 02 '11 at 09:41 AM

Meltdown gravatar image

Meltdown
5.6k 18 25 49

(comments are locked)
10|3000 characters needed characters left

if u want things to bounce nicely you should move them through script, just use the same ray trajectory to moveyour ball across. I did a project like this after seeing the disc battles in tron ;)

more ▼

answered Aug 19 '11 at 03:48 AM

Techsuport gravatar image

Techsuport
81 6 6 10

yeah thanks but I dont really want to write my own physics script (it's only moving/bouncing objects.. I still need nice gravity behavior and wind/force effect etc..

anyway as suggested by Meltdown, all you have to do is make sure you use perfect bounce with no friction on your physics material

basically tuning the materials fixed it but I still can't really predict the gravity/wind behavior perfectly

so I've removed the trajectory from my game :(

Aug 22 '11 at 01:52 AM oxium
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

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

By RSS:

Answers

Answers and Comments

Topics:

x1864
x54

asked: Jun 02 '11 at 08:50 AM

Seen: 1687 times

Last Updated: Aug 22 '11 at 01:52 AM