Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / object position x not working

Author
Message
T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 1st Feb 2010 22:25
hi, i wanted to retrieve the X,Y and Z values of a object, only its not working. whats wrong with it? error says: object number illegal at line 635. i tried several things but its leading to nowhere...

next follows what on line 635 is:



whats wrong with it?
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 2nd Feb 2010 00:07
Hopefully this is inside an if statement that checks if you've clicked the mouse? Then there should be a check to make sure you've actually clicked on an object.



If the code you posted were executed each loop, the object would only be a valid number if your mouse was always hovering over one.

Hope that helps.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 2nd Feb 2010 00:12 Edited at: 2nd Feb 2010 00:14
or try this


or


Dark Physics makes any hot drink go cold.
T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 2nd Feb 2010 12:22
ty HowDo,

i needed to store the variables so i now use this:



your first code snippet does not work, it gives a error. and i didnt know you must this use in a if statement...
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 4th Feb 2010 07:01
In case you don't realize why this was causing an error, the command "pick object" returns an integer that is the object number. It returns the object number OR zero if there is no object. Object zero doesn't exist, and it's considered an illegal object number, so when you say:

bluex = object position x(pick object(mousex(),mousey(),1,40000))

and the mouse isn't over any object (IE pick object returns 0), then that's like saying:

bluex = object position x(0)

which is illegal.


T4r4ntul4
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: close to my pc
Posted: 4th Feb 2010 12:23
ok ty neuro fuzzy that explanation helped me understand it alot.

*happy coding on his 3D Sandbox Editor*

Login to post a reply

Server time is: 2024-11-24 20:54:27
Your offset time is: 2024-11-24 20:54:27