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 Professional Discussion / How do I rotate an object 360 with "wrapvalue" on mouse?

Author
Message
Beyond the Humans Knowledge
15
Years of Service
User Offline
Joined: 27th Oct 2010
Location:
Posted: 5th Sep 2011 20:20
ive imported an object and got it to turn with the mouse, bur it only turns 90 degrees instead of 180 degrees. I cant seem where to put the wrapvalue string. Can anyone help?

onhcet d(-_-)b techno
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 5th Sep 2011 20:26 Edited at: 5th Sep 2011 20:28
Can you show us an example of your code so we know what your doing ? Its hard to help if we do not see what your working with. No need to show ALL your code.. just the part that is relevant to your question.

"Life is like a box of chocolates.. eat it before it melts."
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 5th Sep 2011 20:43
I've used this in my recent piece of code which might help:


Warning! May contain Nuts!
Beyond the Humans Knowledge
15
Years of Service
User Offline
Joined: 27th Oct 2010
Location:
Posted: 6th Sep 2011 07:49
i couldnt remember exactly what i put but heres what i have. I tried to duplicate what i put but i forgot.




onhcet d(-_-)b techno
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 6th Sep 2011 16:01
I could be wrong here, but have you tried replacing this line :

cam#=wrapvalue(cam#+mousey()/2)


with this line ?

cam#=wrapvalue(cam#+mousez()/2)

I changed your mouse orientation from Y to Z.

"Life is like a box of chocolates.. eat it before it melts."
MummyKillerSLO
17
Years of Service
User Offline
Joined: 5th Jul 2009
Location: Object Position Y(ObjChair)
Posted: 6th Sep 2011 16:22
You can't use Mousex() for this. If you want to rotate object with mouse, you must use Mousemovex() because you need movement, not position of the mouse.



Happy to having and using DarkBASIC Professional...
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 6th Sep 2011 16:59
In my code above also I've used floats instead of integers which stops the jerkiness of the mouse movement because I'm dividing the mouses movement by 4.0.

Warning! May contain Nuts!
Beyond the Humans Knowledge
15
Years of Service
User Offline
Joined: 27th Oct 2010
Location:
Posted: 6th Sep 2011 17:58
It didnt go well with my file :/ Here is my file

onhcet d(-_-)b techno
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Sep 2011 18:35
What's the problem? That code works fine for me. I could rotate the object as many times as I wanted by moving the mouse - and in either direction.

Perhaps you aren't moving the mouse correctly?
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 6th Sep 2011 18:39


Per loop only read once the mousemovex() and mousemovey().

Also your object needs its pivot fixing so it points the correct way. When you press "W" I've got it now so it should move forward but your object is at the wrong angle.

Warning! May contain Nuts!
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 6th Sep 2011 18:40
I just tested it. It worked for me as well.

"Life is like a box of chocolates.. eat it before it melts."
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Sep 2011 19:02
I've just compiled his code and it doesn't work. My guess is that the exe in his download (which I tested before) was saved from a different version of the code.

Works fine if you use this instead of the line in his code:

Beyond the Humans Knowledge
15
Years of Service
User Offline
Joined: 27th Oct 2010
Location:
Posted: 6th Sep 2011 22:14
if i keep moving my mouse right, then it will rotate right all the way. same with left. i need it to point to the mouse.

onhcet d(-_-)b techno
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 6th Sep 2011 22:19
It doesn't help if you wait 13 posts to say that it should point at the mouse..

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Sep 2011 23:32 Edited at: 6th Sep 2011 23:41
Indeed.

Edit Try this as your main loop:



There's probably a tidier way of doing it but you've tested our patience enough already.
Beyond the Humans Knowledge
15
Years of Service
User Offline
Joined: 27th Oct 2010
Location:
Posted: 7th Sep 2011 10:22
thanks guys, i appreciate it alot. sorry, i forgot to mention the point towards object

onhcet d(-_-)b techno

Login to post a reply

Server time is: 2026-07-10 09:56:30
Your offset time is: 2026-07-10 09:56:30