Jump to content
Leadwerks Community

Recommended Posts

Posted

..simple..why this code doesnt return any pick when i select different pick types, while without pick type definition, everything works..so..

 

why this works:

Local plane:TMesh = createcube()
ScaleEntity(plane, Vec3(10, 10, .01))
EntityColor(plane, Vec3(1, 1, 0))
EntityType(plane, 1)

Local cube:Tmesh = createcube()
MoveEntity(cube, Vec3(0, 0, -5))
EntityColor(cube, Vec3(1, 0, 0))
EntityType(cube, 2)

Global pick:TPick

While Not KeyHit(KEY_ESCAPE)

 fw.update()
        fw.Render()
 pick = CameraPick(fw.Main.camera, Vec3(MouseX(), MouseY(), 1000))
 If pick <> Null
 	If pick.entity = plane DrawText"PLANE PICKED", 10, 10
	If pick.entity = cube DrawText"CUBE PICKED", 10, 40
 End If
        Flip(0)
Wend
End

 

..and this, entirely same code, just with selection of collision type i want to detect, doesn't ?

Local plane:TMesh = createcube()
ScaleEntity(plane, Vec3(10, 10, .01))
EntityColor(plane, Vec3(1, 1, 0))
EntityType(plane, 1)

Local cube:Tmesh = createcube()
MoveEntity(cube, Vec3(0, 0, -5))
EntityColor(cube, Vec3(1, 0, 0))
EntityType(cube, 2)

Global pick:TPick

While Not KeyHit(KEY_ESCAPE)

 fw.update()
        fw.Render()
 pick = CameraPick(fw.Main.camera, Vec3(MouseX(), MouseY(), 1000),,1)'trying to pick Plane entity, but it doesnt work with cube entity too..
 If pick <> Null
 	If pick.entity = plane DrawText"PLANE PICKED", 10, 10
	If pick.entity = cube DrawText"CUBE PICKED", 10, 40
 End If
        Flip(0)
Wend
End

 

..what the heck im missing here ?

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...