How to get objects Y velocity in bge

game
bge
(Daniel Roberts) #1

I’m trying to make a car game in bge but I need to get the y velocity and put it into a property.
How can I do that in python?

(Daedalus_MDW) #2
import bge

owner = bge.logic.getCurrentController().owner

owner["SPEED"] = owner.localLinearVelocity.y
(Daniel Roberts) #3

I can’t get it to work.
OK got it fixed.
I found out that you can’t use a sensor object.