calculation - handle move on line [SOLVED]
-
On 06/07/2015 at 10:25, xxxxxxxx wrote:
Hello,
I like to use handle in my own object and but i struggle in the calculation. the source for the handle is a position offset from the center - now by moving the handle i like to change the position within the direction.
I found thin in the examples but don`t get the right way how transform this into my vector.
mg = op.GetUpMg()*undo.GetMl()
pos = bd.ProjectPointOnLine(info.position*mg, info.direction^mg, mouse_pos.x, mouse_pos.y)
val = (pos[0]*~mg)*info.directionThanks
Michael -
On 09/07/2015 at 06:49, xxxxxxxx wrote:
Hi Michael,
sorry, it took so long to get to your thread.
I think, by far the nicest example is the Py-RoundedTube example. But you probably already know that.Unfortunately I don't understand your problem. And as you only post code from the Py-SpherifyModifier example, it's a bit difficult to help. Can you please post either some code or perhaps an image of what you are trying to achieve?
-
On 09/07/2015 at 10:52, xxxxxxxx wrote:
Hey Andreas,
it`s hard for me to describe. but i will try it.
I like to generate a Handle that give control over a position (offset from the center of the Object)
i struggle in the calculation - to the correct position by moving the handle.
A) move the handle free in 3d space and generate a ne position
b) move the handle in to extend the given direction - but this can be more than on axis -Hope you can get my problem
-
On 10/07/2015 at 07:45, xxxxxxxx wrote:
Hi Michael,
I'm still not sure, I understood your request completely. In the following I assume, you are familiar with the Py-RoundedTube example and its code.
I'll describe the steps to add a free handle to this example, which delivers a Vector offset from object center.
For A) :
In function GetHandle() :
- for the new handle set info.type to c4d.HANDLECONSTRAINTTYPE_FREE
- for info.postion simply set your offset value (most likely from your offset description)
- info.direction can be set to c4d.Vector(0.0, 0.0, 0.0), it's not neededIn function SetHandle() :
Here you get the new position on handle movements. Simply store the given new position p in your object description.In Draw() :
Actually nothing to do, assuming you want your handle drawn as a simple dot.And that's already it.
Now, for b) : This one I still don't understand. Do you describe a second handle here? Or is it another mode for the first handle (not sure how one would achieve this)? And maybe it's a translation issue, but "move the handle in to extend direction"... I have no idea, what you mean. Sorry. I think, a screenshot with a few quick brushstrokes, showing who you want to move where, could help me. If you have problems adding such to a forum post, you could still mail it to sdk_support.
-
On 26/08/2015 at 09:30, xxxxxxxx wrote:
Have you been able to solve your problem?
-
On 26/08/2015 at 13:14, xxxxxxxx wrote:
yes thanks