|
| 28 Aug 2017 02:03 PM |
it hurts my brain to think of a way to do this. im not asking for a script, i just need ideas as to how to approach this.
player is nearby an object(region3 or .magnitude, and do i have to use a loop for it?), billboard gui appears on top of said object (client only, no FE, i plan to use a billboard gui in startergui and set its adornee), and when the player is actually nearby, hit E to do stuff to the object (user input service)
the problem is that i cant find a better way to check for the object other than using an infinite loop, or as said in another thread, runservice (both on client). and if i wanted to be able to interact with multiple objects (NOT all at once), how can i find a good way to identify such object?
any ideas? |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Aug 2017 03:07 PM |
I did the exact same thing lol.
I tried to make an NPC with dialog using a magnitude detector and a sketchy button system. |
|
|
| Report Abuse |
|
|
xformula
|
  |
| Joined: 03 Apr 2016 |
| Total Posts: 69 |
|
|
| 28 Aug 2017 03:07 PM |
Maybe u should not even use the magnitude or region3 approach. instead use something like Mouse.Target and if they are hovering their mouse over a part which u want to interact with will display a gui with an e and if they press e then they can interact with it
|
|
|
| Report Abuse |
|
|
|
| 28 Aug 2017 03:26 PM |
it sounds like a viable idea until u realize that it'd be less efficient to hover over the object and hit e rather than just clicking on it
i'm not trashing your idea but still, there has to be a better way of doing this than that and the initial approach |
|
|
| Report Abuse |
|
|
xformula
|
  |
| Joined: 03 Apr 2016 |
| Total Posts: 69 |
|
|
| 28 Aug 2017 03:31 PM |
i think the most efficient method would be doing it with runservice. are u trying to find a more efficient method because of lag?
|
|
|
| Report Abuse |
|
|
xformula
|
  |
| Joined: 03 Apr 2016 |
| Total Posts: 69 |
|
|
| 28 Aug 2017 03:35 PM |
wait instead of using magnitude or region3 u can set the MaxDistance of the billboard gui
|
|
|
| Report Abuse |
|
|
|
| 28 Aug 2017 03:36 PM |
yes i am actually, since ive heard stories of unbearable lag due to while true do loops and such. also with runservice, i get the idea but how would i check for objects in workspace?
workspace.brick --if i do this then i'd have to do it for every single thing i want to interact with |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2017 03:37 PM |
| as for max distance, i would do that if it werent for the fact that i cant locate objects to set the adornee of the billboard gui to. again, directly referencing a specific object would lead to painstaking amounts of typing |
|
|
| Report Abuse |
|
|
xformula
|
  |
| Joined: 03 Apr 2016 |
| Total Posts: 69 |
|
|
| 28 Aug 2017 03:42 PM |
just use a infinite while loop and just use waits between calulations that will reduce your lag
|
|
|
| Report Abuse |
|
|
Fangous
|
  |
| Joined: 03 Jul 2010 |
| Total Posts: 4448 |
|
|
| 28 Aug 2017 03:42 PM |
I'm doing something like this right now actually
Currently I'm using a RenderStepped loop checking for magnitude. Since it's the only loop on the client, it's not laggy at all. Then I use worldtoscreenpoint for the GUI. Looks better than billboard guis (imo). |
|
|
| Report Abuse |
|
|
xformula
|
  |
| Joined: 03 Apr 2016 |
| Total Posts: 69 |
|
|
| 28 Aug 2017 03:44 PM |
probably the best option of detecting would be a region 3 since u dont have to use as many calculations
|
|
|
| Report Abuse |
|
|
|
| 28 Aug 2017 03:44 PM |
the question still stands
how would i locate the objects? |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2017 03:47 PM |
if i use region3, would i just have to draw it around the player?
also doesn't region3 just stay in the same place, not constantly being updated? |
|
|
| Report Abuse |
|
|
xformula
|
  |
| Joined: 03 Apr 2016 |
| Total Posts: 69 |
|
|
| 28 Aug 2017 03:52 PM |
yeah it stays in the same place.
u can use renderstepped to update it and have it around your character
you can use workspace's FindPartsInRegion3WithIgnoreList to get parts that are in your region3
|
|
|
| Report Abuse |
|
|
xformula
|
  |
| Joined: 03 Apr 2016 |
| Total Posts: 69 |
|
|
| 28 Aug 2017 03:54 PM |
idk if it would be effient tbh since u would be looping a loop at that point just use the other guys idea of using a magnitude with renderstepped
|
|
|
| Report Abuse |
|
|
|
| 28 Aug 2017 04:46 PM |
| nwe problem; i cant set the region3's cframe or size. anyone know any tricks to getting around this? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 28 Aug 2017 08:53 PM |
so after learning that i cant move region3's, i switched to magnitude and so far ive gotten good results. the only problem now is that i cant seem to find a solid way to identify the object (given that its inside of a model, which is inside of a folder).
what if i want to identify the object but there are multiple copies of it? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 28 Aug 2017 11:02 PM |
How I would do it is I'd check if the object is near the player (use magnitude). If they are close, check the magnitude between the object and the Mouse.Hit.p. If the mouse is close to it, show the billboard.
Just use an infinite loop, they ain't that bad. As long as you don't over use it, you'll be fine.
|
|
|
| Report Abuse |
|
|
|
| 29 Aug 2017 08:40 AM |
| isn't .magnitude for 3d objects and mouse.hit.p for 2d objects? |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2017 09:41 PM |
magnitude is used to find the distance (in studs) between two vectors.
ex: (Vector3.new(0,0,0) - Vector3.new(0,5,0)).Magnitude --would equal 5
Mouse.Hit.p is a vector3 value (its 3d basically) and it returns the position the mouse is in based off of worlds space.
|
|
|
| Report Abuse |
|
|