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 / newXvalue, newZvalue prob.

Author
Message
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 16th Jun 2007 13:19
Ok, this isn't working for me.

My origional intend was to make the mouse visible and when you click on the screen, the ball would go to the nearest grid square. But since that is near imposible, I'll have to do with this.

Left click controls the ball around, works fine
but when you rotate the camera (right click) 90 degrees, is it doesn't.

any sugestions?

Don't look at my sig!
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 4th Jul 2007 03:00
@Link102

Hello,

In regards to your original intention, you can do a bit of a trick by having the camera follow the mouse movement. Instead of the regular cursor, create an object that is a certain distance in front of the camera. This will act as your cursor. As you move the camera around and your "cursor", you get the 3d coordinates from the cursor. This will be the world coordinates relative to your matrix. A little math based on the size of the grid squares will allow you to drop the ball at the nearest square.

Now in regards to your posted code, if you are going to move the object relative to the camera angle, you have to treat the object the same way you'd treat a character in a game that you wanted to strafe left and right. The forward backward movement is easy, that's directly coorilated to the camera angle, but left and right will be offset by 90 degrees. Here's your code with a couple of adjustments based on what I'm talking about:



Enjoy your day.

Login to post a reply

Server time is: 2026-07-06 00:46:20
Your offset time is: 2026-07-06 00:46:20