GetLinearVelocity is broken
by Azmodeus · in Torque Game Builder · 09/26/2006 (8:53 pm) · 7 replies
If I setLinearVelocity my player moves. All fine and dandy.
However, if I hit a wall, my player stops. Still all fine and dandy, except for getLinearVelocity still returns that the player is happily moving along.
Velocity is change in distance over time. I hit a wall, i'm not moving. My velocity is 0.
So I suggest changing the API to be get/setLinearForce (which would remain constant) and fix get/setLinearVelocity to be true to the definition of velocity.
As a work around, I'm having to constantly get my current positiion and calculate its "velocity" based on its position change over time.
However, if I hit a wall, my player stops. Still all fine and dandy, except for getLinearVelocity still returns that the player is happily moving along.
Velocity is change in distance over time. I hit a wall, i'm not moving. My velocity is 0.
So I suggest changing the API to be get/setLinearForce (which would remain constant) and fix get/setLinearVelocity to be true to the definition of velocity.
As a work around, I'm having to constantly get my current positiion and calculate its "velocity" based on its position change over time.
#2
Its still confusing. lol.
09/26/2006 (9:42 pm)
So basically then just the dox needs to be updated to say it returns the variable, not the actual velocity.Its still confusing. lol.
#4
09/26/2006 (11:50 pm)
Bug issue? Is there a place to view current bugs?
#5
09/27/2006 (12:16 am)
That would explain the "slide up the wall" problem with the platformer tutorial and why setting Linear Velocity X to 0 in that case fixed it.
#6
I'm interning at GG and have been working on the docs some, so I reported it in the internal tracker.
I think there might be an external tracker somewhere, but I have no idea where it is.
Definitely a weird issue - non-intuitive indeed.
09/27/2006 (8:51 am)
Quote:Bug issue? Is there a place to view current bugs?
I'm interning at GG and have been working on the docs some, so I reported it in the internal tracker.
I think there might be an external tracker somewhere, but I have no idea where it is.
Definitely a weird issue - non-intuitive indeed.
#7
If the logic required that the player keep a force against the wall they should use a different function. IMO.
09/27/2006 (9:50 pm)
I agree. Personally, I would expect setLinearVelocity to set a variable and let the player move. Then on a colision where the player is stopped andhis velocity turns to 0 that the internal state is updated to reflect that the player is no longer moving.If the logic required that the player keep a force against the wall they should use a different function. IMO.
Torque 3D Owner Stephen Zepp
The main reason for this is something like having the ability to have a moving wall...collide with it until it moves away, then keep on going the way you want.
I admit that the name of the helper method probably could be a bit better, but that is what it's checking--the value of the variables, not measuring a position delta over time.