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.

Dark GDK / Rotation Help

Author
Message
Jna99
19
Years of Service
User Offline
Joined: 3rd Nov 2005
Location: Portugal
Posted: 23rd Aug 2007 23:58 Edited at: 25th Aug 2007 14:54
Hi guys I'm stuck on a rotation problem, the thing is I'm building a 3d menu problem, since I'm using limbs I need to point them always to the camera, but since I can have X or Y angle rotations I can't seam to achieve a perfect solution. See the code below and the pic to see what I want..



EDIT: I decide to change my aproach to the problem

Attachments

Login to view attachments
Jna99
19
Years of Service
User Offline
Joined: 3rd Nov 2005
Location: Portugal
Posted: 25th Aug 2007 15:01 Edited at: 25th Aug 2007 15:15
Hi again currently I need ideas how to get the closest object (front object), but in a dynamic way so that if I have more or less limbs, I would always know...I'm thinking of achieving this through the angles, since each object is positioned accordingly to a specific angle, If I do the difference between the "mother" object and each limb I get the world angle of each limb, but I don't know how to verify if that limb the closest to the camera....here's a pic the central image should be equal to the closest object in the menu

Attachments

Login to view attachments
unitech
17
Years of Service
User Offline
Joined: 27th Jun 2007
Location:
Posted: 26th Aug 2007 18:37 Edited at: 26th Aug 2007 18:38
To get the closest object you would need to use a function like this.




this will give you the distance between the object 1 and 2, just make your camera object 2. At least If I follow you correctly it will work.
Jna99
19
Years of Service
User Offline
Joined: 3rd Nov 2005
Location: Portugal
Posted: 28th Aug 2007 14:04
unitech since I have the angles of each limb I believe I can find a way of using this dynamically but I don't know how, currently I know that if I have 10 limbs I disperse them equally (angle +=360/10 for each limb), at 72ยบ thats the closest limb.. still if every thing fails I'll go with the minimum distance , even if I can only know the minimun value by searching all my limbs!

unitech
17
Years of Service
User Offline
Joined: 27th Jun 2007
Location:
Posted: 28th Aug 2007 14:36 Edited at: 28th Aug 2007 14:37
So you have a rotary type of menu? and you want to know witch is is in the front? Then use dbPickObject(dbScreenWidth() /2,dbScreenHeight /2, first, last); last being your last object ID, first being your first.
Jna99
19
Years of Service
User Offline
Joined: 3rd Nov 2005
Location: Portugal
Posted: 28th Aug 2007 16:11 Edited at: 28th Aug 2007 16:11
Yes Uni problem is that I'm using limbs, which are positioned as I above explained arround an object, so pick would only return that object!

unitech
17
Years of Service
User Offline
Joined: 27th Jun 2007
Location:
Posted: 28th Aug 2007 16:46
Well with limbs all you have is limb offset. You could do a test to see who is closest to the cam like my first example or, do something like this.

Rotate limb x to the cameras rotation, test for limbZ and cameraZ, rotate limb back, then use the closest Z.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 11th Sep 2007 04:46
First, about the distance function supplied above by unitech. I was using a function like that until I learned how to do it with a vector. I DO NOT know vectors well - but I saw some stuff on the forums that showed me how - basically I made a Vector - just one - and I just use it in a distance function. I only mention it because it turned out to be much faster than the square root thingy.

Second: Jna99 - Can you Try gluing your "limbs" as individual objects to an invisible spoked wheel? Then the pickobject thing for the mouse would work, and you'd have all the "individual" object benefits.

Login to post a reply

Server time is: 2024-11-16 20:39:25
Your offset time is: 2024-11-16 20:39:25