playMaker

Author Topic: Help Requested with establishing specific Raycast Direction  (Read 2899 times)

emmcd3

  • Playmaker Newbie
  • *
  • Posts: 8
Help Requested with establishing specific Raycast Direction
« on: April 17, 2016, 10:29:51 PM »
Perhaps I have overlooked the answer in search of Playmaker Actions, but what I would like to replicate is in the attached script.   The C# script works perfectly fine. It has to be inside an FSM to prevent meltdown!  The full script for context is attached. The specific line I'm struggling to find or create in PM is below :

if (Physics.Raycast(myTransform.position + Vector3.up * 0.5f + Vector3.left * 1.5f, ....
So, how would I make it into a PM Action.  Thanks much.

terri

  • Sr. Member
  • ****
  • Posts: 389
    • terrivellmann.tumblr.com
Re: Help Requested with establishing specific Raycast Direction
« Reply #1 on: April 18, 2016, 11:27:48 AM »
Can you describe what this script does exactly?

emmcd3

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Help Requested with establishing specific Raycast Direction
« Reply #2 on: April 18, 2016, 01:34:53 PM »
Sure.. Based on a trigger event it casts out pre-positioned rays which we create a temporary triangle. We calculate the centroid of the triangle and establish the most suitable Vector3 as the next position to move to.  It is not intended to run every frame.  That is superfluous.  Anyway, I'm merely going to customize a string of Action to suit the purpose.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Help Requested with establishing specific Raycast Direction
« Reply #3 on: April 20, 2016, 02:37:53 AM »
Hi,

 it's easy to port such equations to PlayMaker.

 
Code: [Select]
myTransform.position + Vector3.up * 0.5f + Vector3.left * 1.5f
1. save the myTransform.position in a FsmVector3
2: use Vector3Multiply and use 0.5
3: use Vector3Operator to add the left vector3 (-1,0,0 : http://docs.unity3d.com/ScriptReference/Vector3-left.html)
4: use Vector3Multiply and use 0.5

that's it. does that make sense?

you "simply" need to cut down the equation and rebuild it within PlayMaker.

Bye,

Jean
 Jean