playMaker

Author Topic: Set Enemy/npc (or player) Fov 3d or 2d  (Read 27308 times)

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #15 on: December 11, 2015, 11:42:39 AM »
Hi,

1. Ok give me a few days, and I will add tag option to the action..

2. It must the setup for dynamic 3d fov as I have no problems with it on my side. If someone else has an issue please let us know -- Have you tested on a child object in your enemy character (rotation y:90 and y:0)? Have you tested on an another gameoject without Y rotation set to 90 in the current scene to see if it works well? The only time it will 'cut' is if the object is pointing up/down not left/right rotation (due to the Quaternion angle up*forward).

I recommend that you try again (test as mentioned above) and try it on an empty gameobject which is a child of your enemy with rotation set to 0,0,0 and let me know if that works.



foxdeltagames

  • Junior Playmaker
  • **
  • Posts: 62
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #16 on: December 11, 2015, 02:54:49 PM »
Hi,

1. Ok give me a few days, and I will add tag option to the action..

2. It must the setup for dynamic 3d fov as I have no problems with it on my side. If someone else has an issue please let us know -- Have you tested on a child object in your enemy character (rotation y:90 and y:0)? Have you tested on an another gameoject without Y rotation set to 90 in the current scene to see if it works well? The only time it will 'cut' is if the object is pointing up/down not left/right rotation (due to the Quaternion angle up*forward).

I recommend that you try again (test as mentioned above) and try it on an empty gameobject which is a child of your enemy with rotation set to 0,0,0 and let me know if that works.


I actually tried setting the game object to 0, applying the action to a child game object with rotation set to 0,. I also added the action to another game object with the rotation set to 0 and it does the same thing in the vid

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #17 on: December 11, 2015, 05:04:20 PM »
ok.. i don't know.. try it in a new scene and see what happens? and if you bring the cube to the same level as the enemy do you also get the problem?

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #18 on: December 15, 2015, 08:31:03 AM »
@ foxdeltagames

any news? did you try it in a new scene? Why do i ask? I am trying to identify if the problem is in the action or in your scene..

thx

foxdeltagames

  • Junior Playmaker
  • **
  • Posts: 62
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #19 on: December 15, 2015, 04:58:19 PM »
@ foxdeltagames

any news? did you try it in a new scene? Why do i ask? I am trying to identify if the problem is in the action or in your scene..

thx


I tired making a new scene, but now the Dynamic FPV doesn't even work. I get an error. which is :

NullReferenceException: Object reference not set to an instance of an object
HutongGames.PlayMaker.Actions.DynamicVisionConeFov.CastRays () (at Assets/PlayMaker Custom Actions/FOV/DynamicVisionConeFov.cs:217)
HutongGames.PlayMaker.Actions.DynamicVisionConeFov.OnUpdate () (at Assets/PlayMaker Custom Actions/FOV/DynamicVisionConeFov.cs:154)
HutongGames.PlayMaker.FsmState.OnUpdate ()
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.Update ()
PlayMakerFSM.Update ()

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #20 on: December 16, 2015, 10:13:35 AM »
Dude,

I don't understand what you doing.. it works fine.. I have added gif so that you can see the setup.

I have player with no tag and I have enemies with 'enemy' tag.

Note: I use the 'insideFov' result to set the color material by changing the int from 0 / 1 / 2 (= to material array).

sorry about quality but max512kb attachment is hard..
« Last Edit: December 16, 2015, 01:07:58 PM by dudebxl »

foxdeltagames

  • Junior Playmaker
  • **
  • Posts: 62
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #21 on: December 16, 2015, 11:10:36 AM »
Ok I got it working the way it suppose too. Maybe next time try to explain on how to actually use the action.

Though on a side note the normal "Set Enemy FOV 3D" can detect objects that does not collide with the object directly, that is helpful for say enemies that are on a, say second floor looking out the window. Are you still thinking about adding tags to the Set Enemy FOV 3D action? or maybe make a copy of that action and call it something else.


But thanks a ton for the help thus far.
« Last Edit: December 16, 2015, 11:21:13 AM by foxdeltagames »

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #22 on: December 16, 2015, 12:59:52 PM »
*** Update bump

New actions:
SetEnemyFov2dByTag
SetEnemyFov3dByTag

foxdeltagames

  • Junior Playmaker
  • **
  • Posts: 62
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #23 on: December 16, 2015, 01:09:27 PM »
*** Update bump

New actions:
SetEnemyFov2dByTag
SetEnemyFov3dByTag


Nice, Thanks man. I do have to say, you make some really badass custom actions :D

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #24 on: December 16, 2015, 02:17:54 PM »
@ foxdeltagames

bear in mind if you use Dynamic FOV, and you want it to see through walls or objects you need to set the layers.

Player

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #25 on: January 02, 2016, 01:31:27 PM »
Hey dudebxl. You can tell me how to get the name of the object got in sight?
I use Dynamic Vision Cone Fov.

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #26 on: January 02, 2016, 01:52:43 PM »
you cant.. not with the way it is currently built. You need to add some code to line 315 + 327.

Something along the lines of:
line 38
public FsmString name;

lines 315 +327
name.Value= hit.collider.gameObject.name;

**not tested

.. but it all depends on your setup and your goal. The above should work only with one tag obj. If you have many then name.Value should be an array/list then you need to copy this somewhere.. or, the hits are in List<RaycastHit> hits so you could make custom code to extract this data etc.... time consuming...

Maybe it is better to fiddle around mixing with other actions and see if you can get the name by other means.
« Last Edit: January 02, 2016, 05:17:30 PM by dudebxl »

Player

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #27 on: January 02, 2016, 02:45:15 PM »
Thank you.
I do not like array list.

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #28 on: January 03, 2016, 11:59:26 AM »
ok cool.

BTW for everybody else since PM 1.8(not yet tried) supports Array, if you need the full list of objects that the FOV touches, just copy List<RaycastHit> hits into an FSMArray by code in line 315 + 327 and then you have all the objects the FOV touches.

I have not tried 1.8 so I dont know how it would be coded but this logic applies to all actions or script with has a array/lists..
« Last Edit: January 03, 2016, 12:01:21 PM by dudebxl »

Player

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Set Enemy/npc (or player) Fov 3d or 2d
« Reply #29 on: January 03, 2016, 02:02:49 PM »
PM 1.8 gives an error message Unity 4.6.4p4