HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] Suggested Line of Sight and Raycast methods  (Read 1758 times)

shaunb81

  • General Accounts
  • *
  • Posts: 2
    • View Profile
[Resolved] Suggested Line of Sight and Raycast methods
« on: Sep 20, 10, 09:48:10 AM »

Hello,

I was wondering what the suggested functions were for both server and client side LoS checks as well as what functions for raycasting.

Basically we want to ensure a character has LoS with the target before it can use abilities on it.  Will the GetTargetsInCone, etc functions work for this?  I notice the documentation says "Visible targets."  Does that mean a visible property, or visible as in visible from the origin point specified when calling the GetTarget function?  Will terrain and other objects block targets from showing up in the returned results?

Next, after we determine the character has LoS to the target, we want to use Raycasting from the character to the target and determine if there are any objects inbetween that will act as cover and absorb the attack.  I saw at least one raycasting related function/method, and was curious if this or any other function will be able to assist us in this check.

Finally, slightly off topic, but we noticed with Seamless Worlds that while you can see characters on a linked area, you cannot target them with the default world.  Is this something that can be fixed and addressed in scripting, so that we can eventually aquire targets and use abilities on them across linked areas?

Thank you
« Last Edit: Nov 03, 12, 08:41:58 PM by HE-Cooper »
Logged

mdunham

  • General Accounts
  • *
  • Posts: 2
    • View Profile
Re: Suggested Line of Sight and Raycast methods
« Reply #1 on: Sep 30, 10, 12:31:18 AM »

Hello,

I was wondering what the suggested functions were for both server and client side LoS checks as well as what functions for raycasting.

Basically we want to ensure a character has LoS with the target before it can use abilities on it.  Will the GetTargetsInCone, etc functions work for this?  I notice the documentation says "Visible targets."  Does that mean a visible property, or visible as in visible from the origin point specified when calling the GetTarget function?  Will terrain and other objects block targets from showing up in the returned results?

Next, after we determine the character has LoS to the target, we want to use Raycasting from the character to the target and determine if there are any objects inbetween that will act as cover and absorb the attack.  I saw at least one raycasting related function/method, and was curious if this or any other function will be able to assist us in this check.

Finally, slightly off topic, but we noticed with Seamless Worlds that while you can see characters on a linked area, you cannot target them with the default world.  Is this something that can be fixed and addressed in scripting, so that we can eventually aquire targets and use abilities on them across linked areas?

Thank you



For the Seamless targeting, when you target check just check the proxyed node in SAS.

Cheers,
Mike
Logged

shaunb81

  • General Accounts
  • *
  • Posts: 2
    • View Profile
Re: Suggested Line of Sight and Raycast methods
« Reply #2 on: Oct 06, 10, 08:57:31 AM »

Thank you.  We have not yet started our targeting system but will keep this in mind.

If anyone was curious about LoS, the $LoSTracker system node is fairly easy to use although does not seem to be documented in the WIKI.

You can put in a LoS request via the $LosTracker._RequestLOSCheck method.  For first initial LoS testing, I just put the method call in our game specific CommonCharacter class in a CheckLoS method that looks like this.

Code: [Select]
method checkLoS()
  tList as List of NodeRef
  add back MiscUtils:ClientToServerNode( me.getMyAccount().GetClickTarget()) to tList
     
  $LosTracker._RequestLOSCheck(me, tList, me)

Whichever class you specify as the callback node has to implement the following shared function.

Code: [Select]
shared function _LoSResults(handler as NodeRef, request as ID, source as ID, results as LookupList indexed by ID of Boolean)
I also found the command would always return true until I implemented the following method in the CommonCharacter.

Code: [Select]
method _GetLOSPosition() as Vector3
Which just returns me.getPosition() + "0,.2,0"

the .2 will require tuning as without it, you are checking LOS from the source CommonCharacter's feet to the target CommonCharacter's feet.
Logged