简体   繁体   中英

Should the frame-rate dependency taken into account in the calculation of Vector3.Distance?

I have a thesis project where I am moving different game objects with cardboard. The interaction with game objects is done with the cross-hair. Currently, I am grabbing the object and trying to calculate the distance that the object traveled. In other words, I am grabbing the object and move it with cross-hair. Currently, I am calculating the distance like this:

distance = (Math.Abs (Vector3.Distance (newPosition, originalPosition)));

My question is as follows:

  • Should I take into account the framerate dependency and multiply the distance to Time.deltaTime or this distance is framerate independent?

Should I take into account the framerate dependency and multiply the distance to Time.deltaTime or this distance is framerate independent?

No because:

  1. you already know the original and new positions
  2. distance calculations doesn't involve time even during instantaneous calculations

Frame rate or more importantly time since last update impacts when you are calculating a new position based on velocity . In this case time since last update is used as a scalar.

By the way the line

distance = (Math.Abs (Vector3.Distance (newPosition, originalPosition)));

...can be simplified to:

distance = Vector3.Distance (newPosition, originalPosition);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM