Thread: Velocity of an object

  1. #1
    Computer guy
    Join Date
    Sep 2005
    Location
    I'm lost!!!
    Posts
    200

    Velocity of an object

    So, when an object is moving by itself, the velocity will be add to the object's position. What if the object is moving by the mouse, what would it be the velocity? Would it be "vect2(mouseX, mouseY)" ?
    Hello, testing testing. Everthing is running perfectly...for now

  2. #2

    Join Date
    May 2005
    Posts
    1,042
    the velocity vector would be the mouse position minus the position of the object.

    The magnitude (length) of that vector would be the speed (delta distance per unit time).


    Vector3 Velocity = MousePos - ObjectPos; //note that you have to be careful about mousepos, in windows screen coordinates i believe the negative y axis is 'up

    Velocity.Normalize(); //make the length equal to 1

    Velocity = Velocity * Speed; //speed is just some variable you define

    Vector3 FrameMovement = Velocity * dt; //speed is in units per second, so when you multiply speed times the time between frames (dt) that gives you the actual physical movement between frames.
    I'm not immature, I'm refined in the opposite direction.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. using this as synchronization object
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 03-22-2008, 07:49 AM
  2. synchronization object choosing
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 03-22-2008, 04:33 AM
  3. circular doubly linked list help
    By gunnerz in forum C++ Programming
    Replies: 5
    Last Post: 04-28-2007, 08:38 PM
  4. Question on l-values.
    By Hulag in forum C++ Programming
    Replies: 6
    Last Post: 10-13-2005, 04:33 PM
  5. A question about constructors...
    By Wolve in forum C++ Programming
    Replies: 9
    Last Post: 05-04-2005, 04:24 PM