# MEL - Create object at mouse position

**URL:** https://forum.highend3d.com/t/mel-create-object-at-mouse-position/161548
**Category:** Maya
**Created:** [May 6, 2020, 5:15pm UTC](https://forum.highend3d.com/t/mel-create-object-at-mouse-position/161548 "2020-05-06T17:15:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mikrockit](https://forum.highend3d.com/user_avatar/forum.highend3d.com/mikrockit/32/59323_2.png) [@mikrockit](https://forum.highend3d.com/u/mikrockit)
#### Post date: [May 6, 2020, 5:15pm UTC](https://forum.highend3d.com/t/mel-create-object-at-mouse-position/161548/1 "2020-05-06T17:15:07Z")

</div>

Hi guys. I need your help with the script

CreatePolygonCube;  
polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;  
move -r -os -wd **mousePosition**  **mousePosition** 0;

How can I use mouse positon in MEL to use this script? I want to create an object at cursor but only with X and Y coords.

---

<div class="post-metadata">

### Author: ![bfx](https://forum.highend3d.com/user_avatar/forum.highend3d.com/bfx/32/3_2.png) [@bfx](https://forum.highend3d.com/u/bfx)
#### Post date: [May 7, 2020, 6:54am UTC](https://forum.highend3d.com/t/mel-create-object-at-mouse-position/161548/2 "2020-05-07T06:54:01Z")

</div>

float $pos[] = `autoPlace -useMouse`;  
move $pos[0] $pos[1] $pos[2] polyCube1;

---

<div class="post-metadata">

### Author: ![system](https://forum.highend3d.com/user_avatar/forum.highend3d.com/system/32/59311_2.png) [@system](https://forum.highend3d.com/u/system)
#### Post date: [August 2, 2020, 3:00pm UTC](https://forum.highend3d.com/t/mel-create-object-at-mouse-position/161548/3 "2020-08-02T15:00:19Z")

</div>

This topic was automatically closed after 87 days. New replies are no longer allowed.
