Stability of mount points during rotation?
by Tim Scheiman · in Torque Game Builder · 04/17/2012 (6:23 pm) · 6 replies
Heyo.
I'm wondering if anyone has seen this and/or fixed it...
I've got a t2dstaticsprite... mounted to another... such that when the 2nd rotates, the first rotates along with it as if it were the pivot point for it. Let's call this second object the "rotator" for the first. This works like a charm in all of the instances I've used it in the past.
Now... I've connected some code to change the angle of the rotator based on a fixed mouse position (it's bound to an invisible circle during the drag... but that's not important), and I'm running into POSITION stability issues with the rotator itself.
To be clear, during this entire process the only thing being called is the rotator's setRotation(). So the pivot point should NOT be moving.
Here's the video (fullscreen might help to see it):
http://www.youtube.com/watch?v=N7-dpfaseR4
So in the first 4 seconds you can see me drag it around a bit... very stable -- looking like it is supposed to look. (Ignore the jumping around visible cursor... that's just something I didn't get to yet). After letting go and grabbing it again, you can see the pivot point starts to shift around during dragging the mouse. After letting go again and starting again, it gets even worse.
So all that's ever being called is setRotation() on that 'peg' with the arm mounted to it.
My question is: How does that end up moving it around onscreen? Anyone seen this? I think maybe I've got physics set to ON or something somewhere... not that that should matter.
Any help would be greatly appreciated!
-Tim
I'm wondering if anyone has seen this and/or fixed it...
I've got a t2dstaticsprite... mounted to another... such that when the 2nd rotates, the first rotates along with it as if it were the pivot point for it. Let's call this second object the "rotator" for the first. This works like a charm in all of the instances I've used it in the past.
Now... I've connected some code to change the angle of the rotator based on a fixed mouse position (it's bound to an invisible circle during the drag... but that's not important), and I'm running into POSITION stability issues with the rotator itself.
To be clear, during this entire process the only thing being called is the rotator's setRotation(). So the pivot point should NOT be moving.
Here's the video (fullscreen might help to see it):
http://www.youtube.com/watch?v=N7-dpfaseR4
So in the first 4 seconds you can see me drag it around a bit... very stable -- looking like it is supposed to look. (Ignore the jumping around visible cursor... that's just something I didn't get to yet). After letting go and grabbing it again, you can see the pivot point starts to shift around during dragging the mouse. After letting go again and starting again, it gets even worse.
So all that's ever being called is setRotation() on that 'peg' with the arm mounted to it.
My question is: How does that end up moving it around onscreen? Anyone seen this? I think maybe I've got physics set to ON or something somewhere... not that that should matter.
Any help would be greatly appreciated!
-Tim
#2
04/18/2012 (8:46 am)
The actual 'peg' that is being rotated isn't visible... the ones you can see in the art there are just part of the background image.
#3
04/18/2012 (6:37 pm)
Still, my only thought is that the peg it's mounted too is moving. Maybe make it visible and pull it on top of everything to check? That or make the peg itself immovable, but that might mess up your ability to spin. I'm not sure.
#4
I tried setting things to immovable in case it was physics interfering or something, but it didn't change anything. Set both the peg and the arm to immovable and it behaves exactly the same as in the video.
04/21/2012 (11:03 am)
Setting the peg to visible shows a perfectly stable peg -- even as the arm is wobbling around on it, the peg remains rock solid in its position... which means it is the actual mount that is unstable.I tried setting things to immovable in case it was physics interfering or something, but it didn't change anything. Set both the peg and the arm to immovable and it behaves exactly the same as in the video.
#5
For what it's worth I threw together a project with a rotator, a circle to measure it by and the faceMouse behavior set to 0 turnSpeed (which ultimately ends up using setRotation). I don't see the position jitter at all when rotating. Tested with and without physics, collisions and played a bit with mountForce thinking that could be the culprit.
Are you able to get the same thing to happen in another project?
04/24/2012 (8:38 pm)
This is weird. Are you using a behavior or custom code for the rotator?For what it's worth I threw together a project with a rotator, a circle to measure it by and the faceMouse behavior set to 0 turnSpeed (which ultimately ends up using setRotation). I don't see the position jitter at all when rotating. Tested with and without physics, collisions and played a bit with mountForce thinking that could be the culprit.
Are you able to get the same thing to happen in another project?
Torque Owner Bryce Fosheim
Caffeinated Hearts