clicked bone name

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

clicked bone name

Post by davoodice2 »

hi.
is there a function that return name of bone that i clicked on?
I want do it without select that bone
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: clicked bone name

Post by Lukas »

Make sure you’ve got the skeleton and mouseVector and use:

Code: Select all

skeleton:NearestBone(mouseVector):Name()
Edit: Wait NearestBone probably returns the bone ID and not the actual bone, if so, use that to get the bone and then get the name.
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: clicked bone name

Post by davoodice2 »

Lukas wrote: Sat Aug 28, 2021 6:23 pm Make sure you’ve got the skeleton and mouseVector and use:

Code: Select all

skeleton:NearestBone(mouseVector):Name()
Edit: Wait NearestBone probably returns the bone ID and not the actual bone, if so, use that to get the bone and then get the name.
thanks lukas.
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
synthsin75
Posts: 10009
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: clicked bone name

Post by synthsin75 »

Yeah, like Lukas corrected in his edit, it would be:

skeleton:Bone(skeleton:NearestBone(mouseVector)):Name()

You could even get this without clicking, in OnMouseMoved, using:

pfx_ScriptName:NonDragMouseMove()
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: clicked bone name

Post by davoodice2 »

synthsin75 wrote: Sat Aug 28, 2021 9:39 pm Yeah, like Lukas corrected in his edit, it would be:

skeleton:Bone(skeleton:NearestBone(mouseVector)):Name()

You could even get this without clicking, in OnMouseMoved, using:

pfx_ScriptName:NonDragMouseMove()
thanks you synthsin75
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
Post Reply