Velocity Acording to a property?

Hi, i have another (of my MILLIONS of questions) question, how can i make that acording to a property and object add velocity, like, if the property is in 10, the object should move with a velocity of 5, please help and as every time, leave an example file :smiley:

Do you mean speed?

It can be achieved with a python script:

from Mathutils import Vector # vector object to help with vector math

cont = GameLogic.getCurrentController()
own = cont.owner

vel = Vector(own.getLinearVelocity())
vel.magnitude = own['property']*0.5 # Set the length of the vector to half of the property
own.setLinearVelocity(vel) # magnitude of velocity = speed

Velocity is a measure of speed and direction.

hey thanks, but, can you upload an example Blend please? thanks :smiley:

Maaan, I’ve been doing all my vector math manually! I’ve really gotta get with the program, so to speak.

hey thanks, but, can you upload an example Blend please? thanks

No.

Maaan, I’ve been doing all my vector math manually! I’ve really gotta get with the program, so to speak.

I hope you weren’t doing your matrix math manually as well :stuck_out_tongue:

@socker- incorporating it in a blend is extremely simple, just paste it into the Text editor and name the text file, add an always sensor and make sure true pulse is on, connect it to a controller, change that to python, and type in the name of the text file your python script is in.

@andrew-101 Generally when I do matrix math it’s just grabbing a vector from the orientation matrix so it’s not like I ever did anything complex… but I did it manually.