Game Development Community

Mouse over?

by DMT · in Torque 3D Beginner · 06/17/2010 (1:03 pm) · 3 replies

Is there to trigger an event when the (edit)user's mouse passes (/edit) over an object? Maybe though ray casting?

I was thinking something along the lines of :

function PlayGui::onMouseMove(%this, %pos, %start, %ray)

I want to have the cursor change when the user pass over an object that is caught by the ray cast.

Any ideas, thoughts or suggestions?

Thanks.

#1
06/19/2010 (10:46 am)
Is it the player sprite that is moving or is it some sort of laser sight that you're trying to draw?

If it's the player sprite, you can use PickRect(...) using the player sprites position and look for particular objects. If the player is over a sewer grate, you can change the icon to a ladder.

If you're thinking of a laser sight, use PickLine(...) and then iterate through each of the objects returned.

If the player is crossing something like a motion sensor or laser, use PickLine(...) and if the player object is in the list, you know the player is in the beam.
#2
06/21/2010 (3:33 am)
@Nikos Beck

I think PickRect and PickLine() are TGB functions...

Is Torque 3d has PickRect and PickLine functions.

How can i use mousemove function in torque 3d?

#3
06/21/2010 (10:10 am)
My question was specifically pertaining to a users mouse passing over the screen and some call being made as a result of that. At which point a ray is cast and the object being moused over are recognized.

And I believe balmer is right in the sense that those seem to be TGB functions.

Thanks anyhow.