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 / going nut with this 3d mouse problem.

Author
Message
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 2nd May 2005 02:40 Edited at: 2nd May 2005 23:03
Hi All

Going nuts with this code! would like my 3d box being move about with the mouse to stay within the bondery of my 3d plain object.

hint, clue or just point blank answer will do.



<edit> Plus if I used the make object cube 1,-200, will it allow other object move around in it and be dectected.

In Space No One can Hear You Scream! (When your comm Line is cut?)
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 3rd May 2005 01:24
Put some limits on the movment using if/then.
Example:

If xpos#<10 Then xpos#=10
If xpos#>190 Then xpos#=190

This is the concept - change the numbers to meet your needs.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 3rd May 2005 08:16
HowDo,

I have edited your code to include the method RiiDii has stated. Also, on top of using just a couple of IF statements to place the cube back into the box, I have included a couple of 'lock' variables. This is because when using the mouse movement with collision, the object will jitter in and out of its bounds as it is being moved toward them with the mouse.

It's quite simple. There are two 'lock' variables, one for the mouse's x axis movement, and one for its y axis movement. That, if the object goes out of any boundary of the ground, the moving object will be locked at the edge of the boundary and the mouse movement for that axis will be locked until it goes the opposite way of the edge of the box.

For example, if the object goes out of the left side of the box, it will be placed at the edge of the left side of the box. Then, the mouse's x coordinate movement will not be recorded until it is positive(to the right, checked by mousemovex(), which gives either a (-) value or a (+) value).




+NanoBrain+
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 3rd May 2005 10:33 Edited at: 3rd May 2005 10:33
Just a little off track but if you want to try a total re-write try this code, its what I use for my 3d mouse.
Any questions or requests just ask !

WARNING
You will need sparkys collision Dll installed for this to work, its free and very useful, you can find it here:
http://forum.thegamecreators.com/?m=forum_view&t=31051&b=5



Hope this helps, although if its not your cup-o-tea then no worries !

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 4th May 2005 03:03
Baggers nice bit of code but not what i am thinking yet but an ideal is brewing.

NanoBrain tried the code but not much is happing, block moves a little bit then just seem to lock up allthoe locky and lockx say 'no', just puzzled as why nothing is moving.

what screemn mode are you in, that might help, I am using 640x400x16.

cheers

In Space No One can Hear You Scream! (When your comm Line is cut?)
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 4th May 2005 09:28 Edited at: 4th May 2005 09:29
HowDo,

It is strange that you recieve fault when running the program, because it works well for me. I did edit your code to simply use mousemove commands to move the box. Did you add the edited code to your old code? Well, there is not a set display mode command within the code, and I believe the default resolution is 640x400x16.


+NanoBrain+
dlefik 2008
19
Years of Service
User Offline
Joined: 28th Apr 2005
Location: Spencerville, OH
Posted: 4th May 2005 15:07 Edited at: 4th May 2005 15:09
Not to be too technical, but isn't default resolution 640x480x16? not 400. . Also, just thought to try this myself and have to agree with HowDo, I get th esame thing, block moves a tad then locks up alltogether. Oh wait, just discovered it only locked up like that in DBPro, it works a treat in DBC 1.13 for me. Nevermind...lol. I think this would be a fine time to mention maybe people posting in the newcomers forum should somewhere state what version of DarkBasic they're using. It'd prolly help save alot of time and confusion. Just a thought.

Login to post a reply

Server time is: 2024-09-23 19:24:54
Your offset time is: 2024-09-23 19:24:54