Stop rotation on collision [CLOSED]
-
On 13/01/2015 at 09:29, xxxxxxxx wrote:
this can be easily solved, but I need to know how do you set the variable "global newRotation"
-
On 13/01/2015 at 10:06, xxxxxxxx wrote:
Well,
Andreas already pointed me on the fact that I don't need to declare it globally.
I get the value from an object-node (the rotating object) which gives me the current rotation (normally even when it is or should be colliding).I hope this is what you needed?
Greetings,
Casimir -
On 13/01/2015 at 10:14, xxxxxxxx wrote:
what I wanted to know is:how does it rotate?
depending on time? or mouse rotation action? or dynamics? specify whatever thing is rotating it. -
On 13/01/2015 at 10:28, xxxxxxxx wrote:
Oh yeah, sorry for that!
I rotate it manually with my mouse, for animation.
In this example it are just two static objects, but in my bigger file even those two objects move depending on other controls.Cheers,
Casimir -
On 13/01/2015 at 10:41, xxxxxxxx wrote:
so when you rotate with the mouse, it stops at a certain rotation "before the collision" and get stuck, correct?
-
On 13/01/2015 at 11:34, xxxxxxxx wrote:
Yes indeed, and that's kind of what I want, except that now it stops at random rotations.
E.g. sometimes it stops at Pitching 8.45° and sometimes at 9.37°, while it should always be 12°. -
On 13/01/2015 at 12:04, xxxxxxxx wrote:
this code is not tested, test it and tell me if it works.
import c4d #Welcome to the world of Python def main() : global isColliding global newRotation global lastRotationOutput global newRotationOutput if isColliding == False: lastRotationOutput = newRotation newRotationOutput = newRotation else: newRotationOutput = lastRotationOutput + (2 * (lastRotationOutput - newRotation))
-
On 13/01/2015 at 12:07, xxxxxxxx wrote:
This may make the error smaller. But the principal error stays the same.
I'm sorry I need to stamp on the hopes.
Mohamed, did you read my explanation? -
On 13/01/2015 at 12:31, xxxxxxxx wrote:
yea I totally understand where the problem lies, and I tested my code in a simple scene and it failed too "even worse".
I guess a python tag may do it "because you will control the refresh" , but in xpresso it is horrible to do such things
-
On 14/01/2015 at 06:01, xxxxxxxx wrote:
Yeah I'm looking into that.
But, my problem is, how should I calculate the collision? On that level I have no helper functions to use, so I guess I have to code it whole from nil.