Welcome Guest [Log In] [Register]
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:

Username:   Password:
Add Reply
Multiple Objects + Model Selection; Need help to adapt the two systems
Topic Started: Mar 7 2009, 11:48 PM (228 Views)
Devil37
Advanced Member
[ *  *  * ]
Hi there ^_^

I was working around MysteriXYZ's code (and thanks to you for that code :D) which select 3D objects with the 2D mouse. And I was thinking about using this with the MultipleObject system. Is someone has already done this ? I didn't find anything about that.

I worked on, but my code is wrong, it doesn't work. Maybe it came from my adaptation of the example, I don't know. Here is the part of the code that I've adapted in SelectObject():
Spoiler: click to toggle


It's not a very code also ...
Notice that obj_Item is the object which controls the multiple models.
Can someone help me ? :(

Here is the original code:
Spoiler: click to toggle


Many thanks,
Devil37
Edited by Devil37, Mar 7 2009, 11:50 PM.
*.u3d user
Offline Profile Quote Post Goto Top
 
skarik
Member Avatar
kitten eating scum
[ *  *  *  *  *  * ]
Quote:
 
MultipleObject


Have I been missing something in these forums?

Code:
 

var RoomIndex, Closeness;
RoomIndex=0;
Closeness=90000;
//first do a quick general check to see if any of those objects are under the
//cursor...
//with (obj_Camera) Dist=CheckRayIntersection(obj_Item,x,y,z+height,Longi,Lati,RoomIndex);
//...and if there are, do a more specific check to find out which of those is
//closest to the camera
with (obj_Item)
{
var Id, Dist, i;
for( i = 0; i <= ModCount; i += 1 )
{
Id = ID[i];

with (obj_Camera)
{
Dist =
external_call(global.u3d_check_ray_intersection,Id,1,RoomIndex,
x,y,z+height,Longi,Lati
) ;
}

if (Dist < Closeness)
{
Closeness = Dist ;
Closest = i ;
}
}
}


You have only local variables. I made them script-global for you. Try it.

(I really don't know how you guys can read the code all compact-like. I get a headache trying to read it.)

Edit: Didn't see the original script. Oh. Well, yours should work. I mean, I have something almost exactly the same, and it works here.
Edited by skarik, Mar 8 2009, 12:34 AM.
Blog|EHS
Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply