I have problem how to make controlled, rotating object by using physics (and apply torque for exampe) ?
I want to make behavior like: When i click the object > this object should rotate toward 90 degrees from his previous angle and than stop rotating (stops everytime when reached next 90 degrees for example) until next "click/touch" on this object will happend. And but i want to make that on physics because I have idea on logic game with physics elements with gravity etc..
I tried something like that:
1. On left mouse click > apply torque 10000*dt
2. When the object angle = 90/0/180/270 --> set torque to 0
I know, that maybe its not perfect idea so the 'behavior' wasn't perfect - the object sometimes stopped when is reached these angles, but usually it missed them..
I tried that with behavior "rotate" but its isnt precise too...
I tried another way - with anglelerp and another object, which was just a determinant of angles for the right object.
So the objectX (the invisible determinant) had action like: when click left mouse on object > set angle: objectX.Angle + 90 degrees . And the second object with physics smoothly followed by the objectX by anglelerp. So it worked perfect - everytime it stopped when reaches 0,90,180 or 270 angle of direction - but than there was many problems with physics behavior.. and collisions on other objects. For example - my rotating object is a square and it has a hole (shape of the hole is square too for example) (without polygon collision zone in the hole place) inside, near one of corner. And in that hole there is another object - round ball for exmpl. with physics , gravity etc.
And when i was turining the Square object by using the objectX target - many times the ball sprang out of the square..
I don't know if this is understanding what i wrote but i tried. I can't show my example because of low amount of reputation points.
So anyone have solutions for that ?