Jump to content

Picking up objects


ThePhoenix
 Share

Recommended Posts

Hi! im working on a project which need the user to pickup small objects on a table, like keys, cards etc. Is there a way to change the range of selection for it to be smaller? Cause even if the little hand is pointing at an object it might picked up another object thats closer or besides it.

 

 

(line: 450ish in FPSPlayer, and the the icon is 490ish)

local p0 = self.camera:GetPosition(true)

local p1 = Transform:Point(0,0,self.useDistance,self.camera,nil)

if self.entity.world:Pick(p0,p1, pickInfo, 1, true) then

 

tried changing the two zeros in the Transform:Point, but what it does is only moving the object selection range on the x,z axis and keeping the same range. so i can select the object when the middle of the window is more on the left or right.

 

and another question : at the end of a level before loading the new map i would like to fadeout to a DrawRec or Image. I know how to put it full on but is there a way to fade in/out?

 

Thanks guys!

Link to comment
Share on other sites

For the fading, here is a little example:

--In start
Script.alpha = 0
Script.fadeTime = 4

--In your game loop.
context:SetBlendMode(Blend.Alpha)
self.alpha =self.alpha + Time:GetSpeed()* 0.01
context:SetColor(0,0,0,Math:Lerp(0, 1, self.alpha/self.fadeTime))
context:DrawRect(0,0,400,400)
context:SetBlendMode(Blend.Solid)

  • Upvote 1
Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...