FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Linear velocity

2 posters

Go down

Linear velocity Empty Linear velocity

Post  Rahul Mon Jun 01, 2009 8:22 am

I have a shooting game of bow and arrow. I want to move the arrow with some velocity in the direction it is pointed. I have accomplished it in the
following way:

Code:

      vec3 tip = {0.989,1.229,5.083};  //1. Tip of the arrow
      vec3 centre = {3.146,-1.254,3.043}; //2. Centre Location of the arrow
      vec3 result;
      sio2Vec3Diff(&tip, &centre, &result);
      sio2Normalize(&result, &result);
      _SIO2Spear->_btRigidBody->setLinearVelocity(( btVector3( result.x*40.0, result.y*40.0, result.z*40.0) ));

Using 1 & 2 I determine the direction of the vector , normalize it and then apply velocity. However the result is not satisfactory. Considering
arrow is a long object ( not like a sphere), is there any other method to move it in the desired direction with the tip of the arrow pointing in the
desired direction?

Thank you.

Cheers,
Rahul.

Rahul

Posts : 1
Join date : 2009-06-01

Back to top Go down

Linear velocity Empty Re: Linear velocity

Post  sio2interactive Mon Jun 01, 2009 8:40 am

Check sio2rotate3d this will allow you to calculate a forward vector sound an arc.
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum