Getting the velocity vector from position vectors

后端 未结 3 1547
日久生厌
日久生厌 2021-01-29 01:45

I looked at a bunch of similar questions, and I cannot seem to find one that particularly answers my question. I am coding a simple 3d game, and I am trying to allow the player

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-29 02:18

    A very simple implementation could be like this:

    velocity(t+delta) = velocity(t) + delta * acceleration(t)
    acceleration(t) = force(t) / mass of the object
    

    velocity, acceleration and force are vectors. t, delta and mass scalars.

    This only works reasonably well for small and equally spaced deltas. What you are essentially trying to achieve with this is a simulation of bodies using classical mechanics.

提交回复
热议问题