Jump to content
Leadwerks Community

Recommended Posts

Posted
.....
if self.camera:Pick(mousepos.x,mousepos.y,pickinfo) then
   self.picked_entity=pickinfo.entity
   if window:KeyDown(Key.L) then
   pickinfo.entity:Turn(0,Time:GetSpeed()*0.5,0)
   end
end
......

Hi is it possible in any ways to inerract with terrain vegetation, like trees? I want trees to be cuttable, is there any way to do this? I tried picking, it picks the tree but any interaction like moving, hiding, rotating wont work

Posted

I used a variable for picking and when a cursor was on the tree it was positive, also the tree material picking flag is set. I assume that picking is possible, but is it possible to ineract like change rotation?

...
if self.camera:Pick(mousepos.x,mousepos.y,pickinfo) then
self.picked_entity=pickinfo.entity
if window:KeyDown(Key.L) then
 self.ok_picked=1
 --pickinfo.entity:Hide()
 pickinfo.entity:Turn(0,Time:GetSpeed()*0.5,0)
else
 self.ok_picked=0
end
end
...

 

self.ok_picked ws positive when cursor was on the tree

Posted

Well you could print its content to the output screen.

You could retrieve its position, see if that is correct:

pickinfo.entity:GetPosition()

 

You can also enter debug mode (f5) and see what the content is. Ofcourse you need to set a breakpoint

Posted

It might be possible that since you are using the vegetation system, the trees are not common entities. Placing trees by hand via the asset tree, will probably resolve that issue but has the down side of custom tree management.

Posted

but it has to be some entity this reports true:

if self.picked_entity then
context:DrawText("Picked".."entity",10,60)
else
context:DrawText("Picked ".."nothing",10,60)
end

Posted

I think any manipulation is not possible, since vegetation is not stored in memory but uses drawing algorithm which draws entities dynamically every frame depending on seed....

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...