BowtieMod
|
  |
| Joined: 01 Apr 2013 |
| Total Posts: 804 |
|
|
| 12 Aug 2014 09:42 PM |
| Is it possible to use ray casting to see if an object is in the line of sight of another object? |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 12 Aug 2014 09:43 PM |
| Yeesss, it'd be a lot of angles to cover though lol. |
|
|
| Report Abuse |
|
|
|
| 12 Aug 2014 10:06 PM |
Goulstem?
It would be one angle to cover.
Yes, just shoot a ray from one object to the other. If ray makes it without hitting a different object, then return true.
Take Speed AI from the Catalog for a demo of the old method of AI, and shooting Rays. Turn the Graphics toggle in Explorer to true.
|
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 12 Aug 2014 10:13 PM |
| When he said line of sight I thought he meant like.. a player looking at something, their field of view or something. |
|
|
| Report Abuse |
|
|
BowtieMod
|
  |
| Joined: 01 Apr 2013 |
| Total Posts: 804 |
|
|
| 12 Aug 2014 10:16 PM |
Hmm.
How would you go about doing that? |
|
|
| Report Abuse |
|
|
|
| 12 Aug 2014 10:23 PM |
As a model take either the Lazer Gun script or Spaeed AI; both can show u the rays u r shooting (It's best to Draw the rays u r shooting, while developing, so u can seewhat's going on....)
Mod that code from there to do what u want to do:
If u r looking for Player then FindNearest; shoot a Ray at him; Return Hit; if nothing is in the way then take a pot shot at him with your BB gun.
|
|
|
| Report Abuse |
|
|