ThePhoenix Posted February 4, 2016 Share Posted February 4, 2016 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! Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted February 4, 2016 Share Posted February 4, 2016 The 4th argument of the pick can be set to 0. Which means a single raycast. From the docs: radius: the radius of the ray. If the radius is greater than 0.0, a slower swept sphere collision will be performed. As for the fade out, you can draw a black rectangle, and use a timer for its alpha. 1 Quote Link to comment Share on other sites More sharing options...
ThePhoenix Posted February 4, 2016 Author Share Posted February 4, 2016 ok, thank you! is there a way to add distance to the 4th argument. let say the object is a little further than the reach with 0? by creating a local p2 = vec3? or something Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted February 4, 2016 Share Posted February 4, 2016 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) 1 Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted February 4, 2016 Share Posted February 4, 2016 The pick is just a check between 2 points. The 4th argumen indicates the radius of the pick line. With 0 its a single raycast, while with a higher number you get a 'cylinder shape' cast. The 4th argument of the pick is not about distance from 1 point to the other. Quote Link to comment Share on other sites More sharing options...
ThePhoenix Posted February 5, 2016 Author Share Posted February 5, 2016 ok, thanks for your help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.