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 / Object pointing at camera

Author
Message
kamac
15
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 25th Dec 2010 22:00
Okay, so i have a basic loaded space ship, a planet in my view, and i can move it by pressing w,a,d,s. But what i really want, is to delete a and d buttons and replace them by making object rotate to the mouse. So i can let it go up/right/down/left. Here's the code.



If anyone can give me instructions or better - implement the needed code in mine, then i would be very greateful . I just badly need it for my 1st 3d space game .

Cheers!

~Kamac
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 25th Dec 2010 22:18 Edited at: 25th Dec 2010 22:23
What about something like this
kamac
15
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 25th Dec 2010 22:25
Hm, that's not really what i am up to. I mean, it should rotate also when i point upwards, so i can steer the space ship as i wish.

Cheers!

~Kamac
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 25th Dec 2010 22:34 Edited at: 25th Dec 2010 22:35
Don't be so quick to dismiss what I was showing you.
So change the code to add the mouse-Y direction to change the
pitch (up and down direction) of your ship object, or adapt it anyway you want to.
Give it a try, if you get stuck, post your updated code here.
kamac
15
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 26th Dec 2010 12:46 Edited at: 26th Dec 2010 13:06
well, i tried to implement for now only rotating by left&right

But i can rotate it only by left




Oh. lol. I forgot to add .0 in (mx-oldmx)/1000 all works! Thanks!

Edit@

Aha. I have one, last problem. I cannot get camera to point Y coords, so it looks in same height as the space ship. .

Edit2@

Solved that one also Thanks for all the advice BillR!

Cheers!

~Kamac
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 27th Dec 2010 15:19
You're welcome,
Good Luck!

Login to post a reply

Server time is: 2026-07-21 20:36:25
Your offset time is: 2026-07-21 20:36:25