Topic: help with vector please

using sponza as base, I manage to create basic FPS. Now my player can walk, run, sprint, jump, and when I click mouse it returns name of object in front of him. I can also load a text file, read it's content and clone an object in a certain location based on content of the file. Pretty good for 3 days I guess smile

but then my math fails me. Simply put:

I want to apply force to a chair, just like pushing or kicking the chair, when I click my mouse. I already can detect the chair using rayhit, what's left is applying force. It should be something like this if I'm not mistaken

addCentralForce(Chair, someVector)

my problem is determining this 'someVector'. How do I get right vector so I can apply the force at correct direction?

Thanks

[Edit]
I figure it must have some connection with rotation of Head/Camera. I can get that if that value. What I don't get is how to use that rotation value to figure our direction of force, because when I use that value, it simply doesn't work the way it should be

Last edited by penguinroad (2013-07-19 10:29:16)

Re: help with vector please

it depends also how you want to push the chair,
do you want to push the chair in front of you (meaning the fps view) ?

if yes, you can use the same ray you used with "rayHit(V1, V2)" :

force = 10 --set the force you want
someVector = normalize(V2 - V1)*force

addCentralForce(Chair, someVector) -- call this only one time

Re: help with vector please

Yes, this is exactly what I need. Thanks anael smile

Last edited by penguinroad (2013-07-20 03:19:02)