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 / corrosponding Objects x / y co-ords issue

Author
Message
Zan
17
Years of Service
User Offline
Joined: 9th Feb 2007
Location:
Posted: 10th Feb 2007 19:14
I'm trying to move an object (DarkCube using Darkengine plugin) to wherever the mouse is clicked.

I can make the object move in reaction to the clict event np.
just it's about 4 miles off screen.

what is the ratio between a DarkObjects co-ords and those returned by the mouse.



this moves it a long way off screen.

soes anyone have any advice on this?

cheers
Zan
17
Years of Service
User Offline
Joined: 9th Feb 2007
Location:
Posted: 10th Feb 2007 21:40
The delta between the two should be easy to figure out if I know the value of moving 1 unit whatever it is in the object.Move(float x, float y, float z) method.

in my 800 x 600 game window moving an object like so.

object.move(1, 0, 0); = nearly to the edge of the screen.

is there anyway to know how many pixels 1 unit equals?


cheers
Zan
17
Years of Service
User Offline
Joined: 9th Feb 2007
Location:
Posted: 11th Feb 2007 09:18
ok,

I have attached a demo of the movement issues I've been having in another thread - "Windows Form - Moveable Cube".

you can see from the code attached in that thread that I have guesstimated that 1 Move Unit (don't know a better term for this) = roughly 250 pixels.

it has allowed me to get pretty close in the move object to current mouse position. but it's just off a little bit.. especially in the Y axis.

maybe seeing the source code will help with this issue a little bit. I'm sure theres some functions out there already to return the move units in pixels.


cheers
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 12th Feb 2007 10:46
Have you dig into the code snippets forum? Maybe there is something there that helps you...

Login to post a reply

Server time is: 2024-11-19 11:35:41
Your offset time is: 2024-11-19 11:35:41