Little issue with Velocity
synthesis
Member Posts: 1,693
Having trouble fool-proofing actors stopping after dragging out of velocity. The premise is...I am doing a physics test...
Step 1: launch a ball at another ball using a launch trigger attribute (connected to a button).
Step 2: At launch, I change velocity on the ball to 250 and apply a drag of 100 and .02 angular.
Step 3: when the ball's linear velocity of X and Y is less than 10, I change velocity to 0.
(I've also tried forcing all of the actor's velocity attributes to 0)
Steps 2 and 3 are applied to both the shooter ball and the target balls (to collide with)
The shooter ball basically stops and my verification switch activates (a testing switch of the linear velocities that they are indeed below 10).
However...most of the time...if I let it sit for a few seconds...the balls tends to twitch a pixel or 2 here and there.
Is this a bug or am I missing something here?
Anyone have a suggestion of how to foolproof this and get the balls to absolutely stop when their individual velocities are at zero (or near zero)?
Step 1: launch a ball at another ball using a launch trigger attribute (connected to a button).
Step 2: At launch, I change velocity on the ball to 250 and apply a drag of 100 and .02 angular.
Step 3: when the ball's linear velocity of X and Y is less than 10, I change velocity to 0.
(I've also tried forcing all of the actor's velocity attributes to 0)
Steps 2 and 3 are applied to both the shooter ball and the target balls (to collide with)
The shooter ball basically stops and my verification switch activates (a testing switch of the linear velocities that they are indeed below 10).
However...most of the time...if I let it sit for a few seconds...the balls tends to twitch a pixel or 2 here and there.
Is this a bug or am I missing something here?
Anyone have a suggestion of how to foolproof this and get the balls to absolutely stop when their individual velocities are at zero (or near zero)?
Comments
Otherwise...the twitching will not go away. In tracking the values...I have noticed that after all of the physics are done, the lateral velocities dance around -1 and -2 and the rule parameters detect this but I can't seem to force the velocities to 0.
I am not sure what is causing the values to cycle/twitch.
The only way I can figure out how to reset a velocity to 0 (after a shot) is to clone and destroy.
If anyone out there has a cleaner solution...I'm all ears!!!
When they get between -1 and 1, clamp them down to 0
Rule
ALL
When self.Linear.Velocity.X < 1
When self.Linear.Velocity.X > -1
When self.Linear.Velocity.Y < 1
When self.Linear.Velocity.Y > -1
Change Attribute self.Linear.Velocity.X To: 0
Change Attribute self.Linear.Velocity.Y To: 0
You can change -1 and 1 to be as sensitive as your needs require...
It doesn't seem to override the value.
Sometimes they behave correctly on a test play...but rarely.
I've also tried changing velocity to zero.
The only way I have found to have 100% successful control is to clone and destroy.
Its sooo weird. Logically it seems it should work as you describe...but I can't seem to get it to do it more than 5-10% of the time.
http://gamesalad.com/game/play/42356
If we can figure this out...it could be a clean tutorial resource for others for a table top shooting element.
came right to a halt
Tested it out by adding the rule he made to codemonkeys pool game