[Bf-committers] mouse pointer in blender

Campbell Barton ideasman42 at gmail.com
Sat Apr 23 16:43:50 CEST 2011


This is possible in 2.5x but I don't have any example script example
to show you.

You'll want to get the mouse pointer as a vector in 3D space, 2.4x had
a function for this which is property not hard to port see:
BPyWindow.py, mouseViewRay(...)
https://svn.blender.org/svnroot/bf-blender/tags/blender-2.49b-release/release/scripts/bpymodules/BPyWindow.py

Then you can use obj.ray_cast, see:
http://www.blender.org/documentation/blender_python_api_2_57_release/bpy.types.Object.html?highlight=ray_cast#bpy.types.Object.ray_cast

On Fri, Apr 22, 2011 at 3:32 PM, Xavier Thomas
<xavier.thomas.1980 at gmail.com> wrote:
> Hi,
>
> I don't want to be rude but if this is for any kind of game you should
> ask in a user forum (and use a raycast from the camera position in the
> direction of the mouse click ). If this is for Blender editors than
> you should check some of the base operator that does similar thing
> (selection operator?) and reuse the code that can be reused.
>
> Xavier
>
> 2011/4/22 Yuniel Castro González <ycastrog at estudiantes.uci.cu>:
>> Hi.
>> I need to know what is the polygon that is pointing the mouse pointer, for example, if I have a cube I need to get the id of the face is pointing the mouse pointer.
>> Thanks.
>>
>> --
>>
>>
>>
>>
>>
>>
>>
>>
>> Yuniel
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-committers
>>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>



-- 
- Campbell


More information about the Bf-committers mailing list