Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Click Detection  (Read 2560 times)
Xander
Community Member
*
Posts: 16


« on: December 08, 2002, 09:41:32 AM »

Hi

Is there a way to detect if a user clicks on an object?  for example, to move the object and/or change its propertys?

If so, could you post the code :?:

Thanks  Smiley
Logged
JohnnyC
Customers
Community Member
*****
Posts: 1488


WWW
« Reply #1 on: December 08, 2002, 09:52:39 AM »

scene.mousepicking - using the cursors' coordinates.
But remember that tvs mouse coords are not the same as windoze coordinates.
Logged

_________________

John Chewter
Keyne Image
www.keyneimage.co.uk
MP51C
Community Member
*
Posts: 100


« Reply #2 on: December 08, 2002, 09:55:14 AM »

yeah, how does tv do this in windowed mode? does it know to position op the window and then calculates where was clicked?
Logged
Anti-Gremlin
Community Member
*
Posts: 862


WWW
« Reply #3 on: December 08, 2002, 10:10:23 AM »

This is a basic of what i have.. works both Windows/Fullscreen

Code:

    Dim Mx As Long, My As Long
    Dim ImpactX As Single, ImpactY As Single, ImpactZ As Single
    Dim Pick As TVCollisionResult

    Inpt.GetAbsMouseState Mx, My

    Set Pick = Land.MousePick(Mx, My)

    If Pick.IsCollision Then
      ImpactX = Pick.GetImpactPoint.x
      ImpactY = Pick.GetImpactPoint.y
      ImpactZ = Pick.GetImpactPoint.z
    End If
Logged

Project: It's a secret..
Progress: <secret progress>
TV3D Chat: http://www.voidzero.com/chat/chatter.cgi?channel=tviug
TV3D Wiki Doc: http://wiki.truevision3d.com/
TV3D TVDN: http://www.truevision3d.com/tvdna/
SylvainTV
Administrator
Community Member
*****
Posts: 4946


WWW
« Reply #4 on: December 08, 2002, 02:18:08 PM »

Anti-Gremline code is correct, but his way is limited to landscape.

Use Scene.Mousepicking as JC said, it will return all the information you need (collided object, intersection point, normal point etc...)
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
Anti-Gremlin
Community Member
*
Posts: 862


WWW
« Reply #5 on: December 08, 2002, 02:22:57 PM »

I was only giving an example, but yeah just change it to Scene
Logged

Project: It's a secret..
Progress: <secret progress>
TV3D Chat: http://www.voidzero.com/chat/chatter.cgi?channel=tviug
TV3D Wiki Doc: http://wiki.truevision3d.com/
TV3D TVDN: http://www.truevision3d.com/tvdna/
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks