- Home /
What happens when a Vector 3 is set equal to multiplication?
I was reading source code of a project to see how it works and there was a line where a vector 3 variable was multiplied by Time.fixedDeltaTime and transform.up.
e.g. var blah : Vector 3 = transform.up Time.fixedDeltaTime;*
I am wondering what 'blah' is equal to when this happens.
Answer by dhendrix · May 07, 2010 at 12:09 AM
Transform.up is equal to the object's current up vector (depends on which way the object is currently facing), so it could be (1,0,0) or (0,1,0) or (0,0,1). See here.
Time.deltaTime is "The time in seconds it took to complete the last frame". So to answer your question, blah would be equal to a small vector movement, towards the "up" direction of the object. I'm assuming this code is being used to move upwards. Time.fixedDeltaTime is the same thing, except tracks the time since the last physics update (they don't necessarily occur every frame).
You could also multiply another variable to this equation to control the speed of the movement (since direction is taken care of, and delta time smooths out the movement over time).
Not really, since the object can rotate and change directions, meaning it's up vector would change. But if the object never rotates, then yes it's up vector would be constant.
Your answer
Follow this Question
Related Questions
If Expression True in Immediate Window But Code In if Block Never Runs 1 Answer
Highlighting possible move locations in chess-like game 0 Answers
Vector3.Equals without memory allocation? 1 Answer
I want to change the player's ball velocity by entering transparence3D Objects 2 Answers
Rotating a vector around a point 1 Answer