Item creation using mouse

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Display Modes
  03 March 2013
Item creation using mouse

Hello guys, i'm pretty new to max script and i'm facing a trouble i can't solve by myself. For now i created my own rollout and button, with shape creation when pressed. All is fine, but all of them are created at the world origin, as i gave them a 0,0,0 position coordinate.

My aim is now to create them at the position of the mouse. I found in Max Script help the kind of thing a want to do (the Point Creator part), but i dont success to adapt it on my way.
http://docs.autodesk.com/3DSMAX/15/...2B7835E9A3-747D

Here is my script so far

Quote: checkbutton trisphere "Sphere" width:60 align:#left checked:false
on trisphere changed state do
if state == on then
(
local taille = size.value, a

a=Circle radius:taille pos:gridPoint
convertTo a SplineShape
b=Circle radius:taille pos:gridPoint
convertTo b SplineShape
rotate b RotY
c = Circle radius:taille pos:gridPoint
convertTo c SplineShape
rotate c RotY
rotate c RotZ

addandweld a b 0.0
addandweld a c 0.0
updateshape a


tool TriSph
(

fn createtris = in coordsys grid a.pos = gridPoint


on mousePoint clickno do
(
if clickno == 1
then createtris()

else if a != undefined do (a.pos=worldPoint;a=undefined)
)

on mouseMove clickno do
(
if a != undefined
then a.pos=worldPoint
else if lbutton do createtris()
)
)

startTool PointCreator



Max Script listener says an error occurs when i declare the function, it doesn't seems to accept the a.pos = gridpoint...

Does anyone knows how to fix this please ?
Thanks !
 
  04 April 2013
Heelo guys, after a long struggle i found a tricky dirty way to get want i want. I'll keep on fighting with new objective : when i drag the mouse out of the creation point, i want my item scale as well. As i'm not confortable at all with mouse script action, any help is welcome

Quote:

on trisphere changed state do

(
if state == on then
(



tool sphCreator
(
local p,a,b,c, createpoint, taille = size.value, offf = 1
fn createpoint = in coordsys grid p=point pos:gridPoint

on mousePoint clickno do
(

createPoint()
a=Circle radius:taille pos:[0,0,0]
convertTo a SplineShape
b=Circle radius:taille pos:[0,0,0]
convertTo b SplineShape
rotate b RotY
c = Circle radius:taille pos:[0,0,0]
convertTo c SplineShape
rotate c RotY
rotate c RotZ

addandweld a b 0.0
addandweld a c 0.0
updateshape a
a.name = uniquename "Sphere"
a.wirecolor = colo.color
a.pos = p.pos
delete p
)


)
startTool sphCreator
if rbutton = true do (stoptool sphcreator; trisphere.changed (trisphere.checked = false))

)

 
  04 April 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 06:25 PM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.