Non-Engine Physics

If I have one object collide with another and want the hit object to move away along the appropriate vector, how would I calculate that vector?

Vector3.Reflect, probably. Although the docs aren’t exactly overwhelming with detail and examples in this case. :wink:

–Eric

It depends on a lot of things, but for simple stuff myVelocity = Vector3.Reflect(myVelocity, hit.normal) * bounceFactor; works great.

Yeah, I saw Reflect and thought it might be the ticket, but man, talk about your absentee docs? :wink:

I’m curious though, how about if you don’t have a normal?

I did a quick search and noticed that nobody had yet logged a bug on that doc page so I went ahead and submitted one. It’s rather light on info eh? :wink:

You have to have a normal, or at least some idea of one as you’re bouncing one object off of another so you’ll have a surface normal at the point of contact (assuming reasonably simple shapes). Therefore you should always (I believe) be able to obtain some sort of normal for your collision.

You think that’s skimpy, check out the entry at Unity/Documentation/ScriptReference/ForceMode.Impulse.html.

Well, I wasn’t hoping to turn this into a contest of who can find the skimpiest page or anything… :wink:

I couldn’t find a bug logged against that page so I’ll enter one. If you find these sorts of doc pages then please enter a bug so we (in this case “we” = Sam) can fix them, thanks! Of course if you have logged a bug then forgive me, a full text search of the bug base using ‘ForceMode’ came up empty.