| We hope you enjoy your visit. You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you are already a member please log in to your account to access all of our features: |
- Pages:
- 1
- 2
| selecting models | |
|---|---|
| Tweet Topic Started: Nov 17 2007, 07:19 PM (958 Views) | |
| spiff88 | Nov 17 2007, 07:19 PM Post #1 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
im working on an object placement editor like loading models putting where u want them then saving in U3D format, ive come across my first problem selecting the model so u can edit properties im trying to just select the object based on if its in the middel od the screen im not sure how to do this so plaease advice. |
![]() |
|
| MysteriXYZ | Nov 17 2007, 07:52 PM Post #2 |
|
Master Matrix Masher
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Please see this post. That code uses the mouse coordinates and it checks if a specific model is under the cursor, so it should help ;). |
| U3D is like candy; after extensive consumption, it's Best to brush. | |
![]() |
|
| spiff88 | Nov 17 2007, 09:05 PM Post #3 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
how am i spposed to use this |
![]() |
|
| MysteriXYZ | Nov 17 2007, 09:33 PM Post #4 |
|
Master Matrix Masher
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
In the following line of code, you need to replace "ModelID" with the ID of the model object you want to select:
Then the variable "Clickable" will indicate whether or not that object is under the cursor. If it is, then PointX/Y/Z will give you the coordinates of the point on the model object that the cursor is over (in case you need them to move the object, for example). Either call this code in the camera Step Event or inside a "with (camera)" statement, if you need to use it in another object event. |
| U3D is like candy; after extensive consumption, it's Best to brush. | |
![]() |
|
| spiff88 | Nov 17 2007, 09:50 PM Post #5 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
u explained pretty good on what it does but im still confused on how basically check if its selected so while its selected u can move it with the arrow keys and rotate, ect.. |
![]() |
|
| MysteriXYZ | Nov 17 2007, 10:02 PM Post #6 |
|
Master Matrix Masher
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Well, when you found out (through the variable "Clickable") that the model object is under the cursor, also check if the left mouse button is pressed for example. If that's the case, set a local variable "selected" (or whatever you like) of that object to true. Then when you select another object in the same way, you can set the "selected" variable (of that previously selected model) to false again. And then it's a matter of checking the "selected" variable of each model to see which one is selected. Alternatively, you could also assign the ID of the selected model itself to a global.SelectedObj variable. |
| U3D is like candy; after extensive consumption, it's Best to brush. | |
![]() |
|
| spiff88 | Nov 17 2007, 10:10 PM Post #7 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
what about dealing with multiples of the same object, because the only way i figure u can load a model is through one object, so won't it select all the same objects? |
![]() |
|
| MysteriXYZ | Nov 17 2007, 10:51 PM Post #8 |
|
Master Matrix Masher
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Then you can either store the ID's of all the instances in an array (or ds_list) and put the following part of the code in a for-loop to cycle through all instances:
or you can use that part inside a "with (ModelObject)" statement:
Each instance can have its own local "selected" variable. |
| U3D is like candy; after extensive consumption, it's Best to brush. | |
![]() |
|
| spiff88 | Nov 17 2007, 11:10 PM Post #9 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
for the last one 2 questions- do i have to setup the id in the model object or does it do it automatically in the code already and with the ID's to have to change those to the object model names(bare with me here, its a little confusing) |
![]() |
|
| MysteriXYZ | Nov 17 2007, 11:34 PM Post #10 |
|
Master Matrix Masher
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
In the "with ()" version, you only need to replace "ModelObject" with the name of the object. Nothing else has to be changed. But I forgot to mention that you need to add the following to the top of that code:
Otherwise "ID" will not be known inside the "with (camera)" block. If you are going to click on objects to select them, then it will be more efficient to place the entire code in the Left Pressed Event of the camera (instead of the Step Event). In that case, you can also replace each occurrence of the "Clickable" variable with "ID.selected". |
| U3D is like candy; after extensive consumption, it's Best to brush. | |
![]() |
|
| spiff88 | Nov 17 2007, 11:49 PM Post #11 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
i know this question will be a drag but one thing still has got me is that so now know which individual model is clickable based on its id where do i go from there im still confused with how u actually "select" an object based on id when its clicked |
![]() |
|
| MysteriXYZ | Nov 18 2007, 12:02 AM Post #12 |
|
Master Matrix Masher
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Okay so now you are able to set the "selected" variable of each object instance, based on whether or not it was clicked upon, right? The next step is to perform the desired action (rotating, moving, etc.) with only the object that has its "selected" variable set to true. So you have to add a piece of code to an event of an object of your choice that searches for that selected object and performs the action, like this:
where "ModelObject" once again needs to be replaced with the name of the object. |
| U3D is like candy; after extensive consumption, it's Best to brush. | |
![]() |
|
| spiff88 | Nov 18 2007, 12:05 AM Post #13 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
no actually making the object selected |
![]() |
|
| MysteriXYZ | Nov 18 2007, 12:18 AM Post #14 |
|
Master Matrix Masher
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
If the particular object instance has its "selected" variable set to true, then it is selected. It may not be visibly so, or do anything to indicate that fact, but if that's what you want, you have to make it so. And that's achieved by following the advice I gave you in my previous post. You can give it a different color, or make it brighter, change its size etc. using that code. It's selected in the sense that it has its "selected" variable set to another state (true) than all the other instances (false), so now you have to use that info to manipulate only that instance. |
| U3D is like candy; after extensive consumption, it's Best to brush. | |
![]() |
|
| spiff88 | Nov 18 2007, 12:24 AM Post #15 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
ur not getting the question i already how to make it look selected im having trouble understanding how to switch the selected variableto make the model selected u already gave on how to check if its clickable so then what, what do i do next |
![]() |
|
| Go to Next Page | |
| « Previous Topic · Questions about Ultimate 3D · Next Topic » |
- Pages:
- 1
- 2





![]](http://z1.ifrm.com/static/1/pip_r.png)



9:38 PM Jul 11