I’m trying to control an object using the mouse. I’ve got a script that gets the mouse position and then sets the dLoc values according to the mouse’s position.
However, it’s not working quite as I want it to. The object doesn’t stop when the mouse stops. And, the further away from the center of the screen (0,0), the faster the object goes.
I just want the object to be exactly where the mouse is all the time. Any ideas? Here is the file:
if the speed is based on the cursor’s position, only when the cursor is at the origin [I belive it is the lower left corner] will the object not move
just make it so that your object moves based on the cursor’s movement, but don’t try to get [or assume that they are] in synch, it will be very difficult [particularly when the edges of the camera don’t align with the edges of the view, like in the 3d view]
so, what I’m trying to say is that you should set the position of your object based on where the cursor is… it seems that is a lot more like what you’re trying to do anyway
it sounds like you want a blender 3d object to stay perfectly lined up with the system cursor [as it moves around…]? is this correct?
so… does that mean it will be on a plane perpendicular to the screen?
yep, that’s exactly right. It seems like there is some equation that I need to use. Or, I need to move the object using something other than the dLoc attribute. Maybe I’m mistaken about what the dLoc does. I thought it would put the object at a certain location, not move it continuously (like it’s doing now).
do you have
W = Rasterizer.getScreenWidth()
H = Rasterizer.getScreenHeight()
well, yes. there is a script at the very beginning that sets the mouse to the center of the screen. But, I want the mouse to move normally and have an object go along with it. Like Pong! The paddle moves exactly where the mouse goes (in real time).