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 / Object Rotation Using Mouse

Author
Message
Cas
13
Years of Service
User Offline
Joined: 12th Nov 2010
Location:
Posted: 3rd Dec 2010 04:40
Hi, I have a crosshair in my game which will guide the players' aim. At the moment I am able to rotate the object (on the Y axis as it's the only axis I want to rotate it on) but it doesn't do it right. If I move the mouse left/down the object rotates anti-clockwise and the opposite for right/up.

Bascially I'd like to know how'd I go about making the object follow the mouse/crosshair exactly be it in a circle or when quickly moving back and forth from anywhere.

Here's my code.....apologies if you find it hard to read, I don't like having to retype code when I am experimenting.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 3rd Dec 2010 14:37
What are you trying to "rotate"?

The fastest code is the code never written.
Cas
13
Years of Service
User Offline
Joined: 12th Nov 2010
Location:
Posted: 3rd Dec 2010 18:27
I'm trying to rotate my plane on it's Y axis so the nose of the is pointing towards the mouse pos/crosshair.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 5th Dec 2010 00:20
Ok. It seems to me you need to use

This next part you will have to figure out yourself as you may want different values. Also, the *100.0 above may need to be tweek'd.


The fastest code is the code never written.
Cas
13
Years of Service
User Offline
Joined: 12th Nov 2010
Location:
Posted: 5th Dec 2010 12:05
Cheers mate, I'll give it a try when I get home. Really hope it works

Login to post a reply

Server time is: 2024-06-28 01:17:50
Your offset time is: 2024-06-28 01:17:50