Adam's Lair Forum

game development and casual madness
It is currently 2017/04/28, 02:30

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 2017/02/06, 22:47 
Member
Member

Joined: 2016/10/14, 01:05
Posts: 71
Role: Hobbyist
Hello, it's been a while!

I was wondering how I would add a MouseOver Event handler to a GameObject?

Thanks.

JB


Top
 Profile  
 
PostPosted: 2017/02/07, 09:44 
Veteran Member
Veteran Member
User avatar

Joined: 2015/10/04, 15:48
Posts: 153
Location: Germany
Role: Hobbyist
Hey ^^

I've already asked a quite similar question in this topic:
viewtopic.php?f=4&t=1050

The easy way:
Just great a new rectangle in your component and check, if the mouse (position) intersects the rectangle.
There's a method called "Intersects(x, y, w, h)" -> returns boolean

Another way is the use raycasting. For this approach you gameobjects need a rigidbody attached though.
Here is an example by Adam:
http://www.adamslair.net/forum/viewtopi ... 1041#p6341

_________________
Twitter | GitHub | Join Duality on Discord | itch.io


Top
 Profile  
 
PostPosted: 2017/02/07, 21:16 
Member
Member

Joined: 2016/10/14, 01:05
Posts: 71
Role: Hobbyist
Thanks Cross, I will check that stuff out.

JB


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group