Hello everyone... I was bored yesterday night and whipped up a piece of code I liked. Basically, the camera hovers above the player; if you move your mouse over a player or enemy (read: immoble sphere) it shows said object's label. Great. Now I want to be able to move my player.
I know how to detect if the mouse is over or has clicked on an object, that's easy with the built-in commands. The problem is, I want to be able to get a point in space directly under the mouse cursor that is not dependant on an object being there-- I'm using big objects for the ground and I want this to be exact.
All I've managed to work out is something that determines the difference between the object's screen position and the mouse's screen position, and translates it into 3d space. But I don't think this is the way to go for 2 reasons:
1- Ideally I want to be able to tilt the camera a little, and this relies on it being fixed AND the resolution being the same (I can live without it if I must, though)
2- It's inacurrate! Very much so in fact. It's okay if I'm only around 80 pixels around the player, but after that the target spot begins to go wildly away from what I'm looking for.
I've looked around on the forums and browsed through several code snippits but all I've found is code for actually selecting objects.
Furthermore, what's wrong with this code piece here?
if playerposx#playertargetx#-40 and playerposy#playertargety#-40 then haveatarget=0
It should set haveatarget to 0 if the player is within 40 3d squares of the target space. I've done a lot of testing to see what's going wrong, and it appears that all of it works except for the final check, which never returns a 1. Thus my object just keeps on moving. Sorry if it's an obvious problem, I'm rusty as an Minoan cogwheel.
Thankee...
--Mouse
Famous Fighting Furball