Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - makaan

Pages: [1]
1
Modification Help / Re: Mouse position to world coords (in script)
« on: August 30, 2007, 11:25:47 AM »
So,

Code: [Select]
%Pos3D = VectorAdd(%client.camera.getPosition(), VectorAdd((%x / 15) SPC "0" SPC (%y / 15), %client.player.getForwardVector()));

=

camera pos + ("x/15 0 y/15" + forward vector)

2
Modification Help / Re: Mouse position to world coords (in script)
« on: August 30, 2007, 10:43:00 AM »
as long as I can get help to capture the 3d position, i can script the rest

3
Modification Help / Re: Mouse position to world coords (in script)
« on: August 29, 2007, 11:42:22 PM »
what i'm saying is as long as you have x and z of the delta vector, you don't need y (you can ray cast until you hit an AIPlayer). In other words, instead of a zoom method like you were talking about, it just finds the first AIPlayer on the line extending forward from the point where the player clicked.

4
Modification Help / Re: Mouse position to world coords (in script)
« on: August 29, 2007, 06:32:46 PM »
You should be able to do it in script if you knew the 2d position of where the client clicked and the client's resolution.

Look at this picture:

5
Modification Help / Re: Mouse position to world coords (in script)
« on: August 29, 2007, 04:39:31 PM »
what's that?

I'm trying to make an object selection tool in script.

6
Modification Help / Mouse position to world coords (in script)
« on: August 29, 2007, 03:32:17 PM »
I know this should be done in C++ but I'm wondering how to get the 3D world coordinates from the 2D mouse position.

here's what i have so far (which doesn't work very well):
Code: [Select]
// commandToServer('GetMouse3DPos', canvas.getCursorPos(), getRes());

function serverCmdGetMouse3DPos(%client, %clientMousePos, %clientRes) {

%Pos2D = (firstWord(%clientRes) / 2) SPC (getWord(%clientRes, 1) / 2);

%x = firstWord(%clientMousePos) - firstWord(%Pos2D);
%y = getWord(%clientMousePos, 1) - getWord(%Pos2D, 1);
// The cursor position is based off of the top-left corner of the screen
// This makes x and y relative to the center of the screen

%delta = "0" SPC (%x / 10) SPC (-%y / 10);
// If you click above your player, for example, this will be about:
// 0 0 1
// The z value is how far above your player you clicked

error(%delta);
%Vec3D = VectorAdd(%client.player.getForwardVector(), %delta);
%Vec3D = VectorAdd(%Vec3D, %client.player.getPosition());
messageClient(%client, '', '3D position is: %1', %Vec3D);
}

7
Modification Help / Re: Controls repeating in Controls
« on: August 29, 2007, 10:24:41 AM »
Code: [Select]
if( !$addedPlatformMaps ) {
   ...
   $addedPlatformMaps = true;
}

Don't forget that part :)

Pages: [1]