yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 17 Apr 2015 03:57 AM |
In my game, each player has a plot called PLAYERNAMEfloor. They are allowed to place down models, when the model is placed, how can i do a check to see if it is touching the plot, and if it isn't then destroy it.
So like
if not touching plot then model:Destroy() end |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 17 Apr 2015 03:59 AM |
| Instead, check whether where they're placing it is on the plot. Drive their input instead of using that kind of approach. |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 17 Apr 2015 04:01 AM |
| Get the boundaries for the model and compare it to the mouse position. |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 17 Apr 2015 04:05 AM |
But how would i compare.
1.)I get the positions of the corners of the plot 2.) How do i say if it is within the corners? |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 17 Apr 2015 04:10 AM |
| Is Centre+(Extents/2) inside the plot region? |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 17 Apr 2015 04:11 AM |
| I don't really understand sorry, is there an easier way like fire a raycast directly downwards and see if it hits the floor or something? |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 17 Apr 2015 04:13 AM |
| Of course. I just avoid raycasting when I don't need to because it's a relatively expensive operation ^^ |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 17 Apr 2015 04:15 AM |
| How does findPartonRay Work? |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 17 Apr 2015 04:19 AM |
Region3 would work really well for this.
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 17 Apr 2015 04:19 AM |
| A lot of additions, subtractions and divisions |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 17 Apr 2015 04:21 AM |
| How does region 3 work? <----- Big noob here (i have never needed it before) |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 17 Apr 2015 04:23 AM |
| I assume the constructers are the corners of the plot? |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 17 Apr 2015 04:25 AM |
| The constructor arguments are the lower front extent and the upper back extent |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 17 Apr 2015 04:28 AM |
| And then how do i check if when the model is placed it is inebtween these constructors? |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
udayk8139
|
  |
| Joined: 25 Aug 2013 |
| Total Posts: 622 |
|
|
| 17 Apr 2015 05:29 AM |
| Um, I am not sure about these.. |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 17 Apr 2015 06:04 AM |
| Howe do i say if brick intersects into the region 3 |
|
|
| Report Abuse |
|
|