Linear velocity

Go down

Linear velocity

Post  Rahul on 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:


      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.



Posts : 1
Join date : 2009-06-01

View user profile

Back to top Go down

Re: Linear velocity

Post  sio2interactive on Mon Jun 01, 2009 8:40 am

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

SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch

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

View user profile

Back to top Go down

Back to top

- Similar topics

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