Hello! guys! I want to make a tool plugin like a brush tool, and i can use this tool draw objects on other object surface.And now, i want my drawn object to follow the direction of my mouse, like this:
Actually, i have a simple idea for this;
next_obj = parent_obj.GetDown().GetNext()
pos = -(next_obj.GetPred().GetRelPos() - next_obj.GetRelPos())
normalized = pos.GetNormalized()
rot = c4d.utils.VectorToHPB(normalized)
pred = obj.GetPred()
next_obj = next_obj.GetNext()
But I think this method is too forced, I don't know if I can get the mouse direction information
No spline path,just surface of object
there is no thing as mouse direction. The mouse has a position. The direction is the result of comparing two mouse positions.
as @zipit stated, you can create a tool that implements MouseInput(). Within MouseInput() you can use ViewportSelect.PickObject() to check what object and what point the mouse is currently over (Using BaseView.SW()). You can store the previous mouse position and compare it to the current mouse position to calculate the direction.
Unfortunately, there is an issue with the Python version of PickObject() (How do I find the z-depth with Python ViewportSelect.PickObject()?), so you might have to implement your idea as a C++ plugin. You find some code in the pickobject.cpp example.