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.

DarkBASIC Discussion / Moving 3D Objects With Mouse

Author
Message
The Bad Coder
20
Years of Service
User Offline
Joined: 21st Sep 2004
Location:
Posted: 26th Apr 2005 17:12
Well, I've spent a huge amount of time trying to think of how to make this work without having to ask but I felt it was time to speak up. Right now I have no code to show because I can't figure out even how to begin doing this, but here's my situation. Let's say I have a matrix, and the camera is above the matrix angled down to see the matrix. Now what I want to do is put a sphere on the matrix to represent a marker but I want to be able to move this marker around the matrix based on the 2D coordinate of the mouse pointer. I remember seeing someones code around here and it was just really confusing yet it looked pretty simple. He used the object screen x() and object screen y() commands in the code to find out where the mouse was on the screen then move the object around the matrix to follow the mouse. Now I'm not really looking to have someone just give me a code as I want to try and code this myself, but rather if I can get some ideas on how to approach this and work from there. Please try and explain as simple as possible as I confuse easy sometimes Thank you soo much in advance if someone can guide me.
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 27th Apr 2005 06:34 Edited at: 27th Apr 2005 06:36
you need to use mousemoveX() and mousmoveY() and none of that objectscreenX() stuff.
I made a code becouse I din't read you post carefully enough, so

don't press this button:


but you can use this for a peak, it's about as optimised as it can get. plus i've added noted all over the place so even the biggest morron can understand it.
The Bad Coder
20
Years of Service
User Offline
Joined: 21st Sep 2004
Location:
Posted: 27th Apr 2005 16:57
Sorry it took a bit to respond but I want to sincerely thank you link101 for helping with this. I gave your code a quick whirl through darkbasic just to see what it could do and this is exactly what I was trying to achieve, and the coding looks soo much more extremely simple than the previous one I had seen. So my next plan is to tear this code apart, study it real good, and try to do it myself. Thanks a million again!
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 28th Apr 2005 20:53 Edited at: 28th Apr 2005 20:54
uhm that's link102
ah, victory

please reply
HWT
20
Years of Service
User Offline
Joined: 1st Apr 2005
Location: Earth
Posted: 5th May 2005 23:25
Hi there

I'm not exactly sure that this is what you wanted but I think it might help. Though it doesn't position the object right under the mouse you can still move the object with the mouse buttons.


Hope this helps

HelloWorld Tommorrow

Login to post a reply

Server time is: 2025-05-23 04:27:25
Your offset time is: 2025-05-23 04:27:25